title: Cannot read property 'Msgtext' of undefined while execution using protractor
body: <p>I have created a function in my PO file as below,</p>
  
  <pre><code>'use strict';
  
  var FunLib = function(){
  
  this.Msgtext = element(by.css('.layout-row.flex-gt-md-66.flex'));
  this.AltEle = element(by.css('[ng-show="alert"]'));
  this.ExcMsg1 = "YOU ARE LACKING ONE OR MORE..."
  
  //Function Button Click
  this.ButtonClick = function(ButtonName){
      this.ButtonName = ButtonName;
      this.Button = element(by.buttonText(ButtonName));
      this.Button.click();
  };
  
  //Function to handle exception of Permissions
  this.PermissionExc = function() {
      this.AltEle.isDisplayed().then(function(IsPresent){
          console.log(IsPresent);
          if (IsPresent) {
              this.Msgtext.getText().then(function(text) {
                  console.log(text);
                  var Message = text;
                  if (Message == this.ExcMsg1) {
                      this.ButtonClick('Close');
                  }
              });
  
          }
      });
      browser.sleep(2000);
  }
  };
  module.exports = FunLib;
  </code></pre>
  
  <p>In my spec file I used it as below,</p>
  
  <pre><code>FuncLib.PermissionExc();
  </code></pre>
  
  <p>When I execute my code I am getting error "<strong>TypeError: Cannot read property 'Msgtext' of undefined</strong>".
  Can anybody tell me where am I going wrong? Please suggest.</p>