title: Angular 2/ Ionic access class function
body: <p>Using Ionic (Angular 2) I'm building an app but the following code does not seem te work because I cannot access the function leaveGroup(group) in the Dialog promise.</p>
  
  <pre><code>leaveGroupTapped(event, group) {   
   this.dialogs.confirm("Are you sure you want to leave this group?", "Confirm")
      .then(function (index) {       
        if (index == 0) {
          //dialog dismissed - do nothing
        } else if (index == 1) {
          //OK call next function to remove the group   
          this.leaveGroup(group) //does not work ofcourse
        } else {
          //Cancel
        }
     });
  }
  
  leaveGroup(group) {
  //Do some stuff here
  }
  </code></pre>
  
  <p>How would you make this work?</p>
  
  <p>Thanks</p>