title: Ionic 2 cordova InAppBrowser browser.close() is not a function
body: <p>I am integrating a payment gateway in my ionic app in which i am using node js on the server side. On a click of button i am redirecting user to the payment gateway page using ionic native inAppBrowser after which i am listening to url events. When the payment is successful then the browser will redirect to success url else it will redirect to failed url. Based on this i am handling the UI in the app. My problem is when i listen to the success/failed url and call the <strong>close browser</strong> event i get this error.</p>
  
  <blockquote>
    <p>Uncaught TypeError: this.browser.close is not a function</p>
  </blockquote>
  
  <p>I have also tried hide() method but i get the same error.
  Following is my code.</p>
  
  <pre><code>import { Component } from '@angular/core';
  import { NavController } from 'ionic-angular';
  import { Http } from '@angular/http';
  import { InAppBrowser, InAppBrowserEvent } from '@ionic-native/in-app-browser';
  @Component({
    selector: 'page-home',
    templateUrl: 'home.html'
  })
  export class HomePage {
    event : any;
    browser:any;
    failed : boolean = false;
    success : boolean = false;
    constructor(public navCtrl: NavController, private http: Http,private iab: InAppBrowser) {
  
    }
  
    payment(){
      this.browser = this.iab.create('http://192.168.0.59:3000/post').on("loadstop")
       .subscribe((ev: InAppBrowserEvent) =&gt; {
  
                if(ev.url == "http://192.168.0.59:3000/failure"){
                  console.log("payment failed");
                  this.failed = true;
                  this.closeBrowser();
                }else if(ev.url == "http://192.168.0.59:3000/success"){
                  console.log("payment success");
                  this.success = true;
                }
  
            });
  
        }
  
        closeBrowser(){
          this.browser.close();
        }
  
      }
  </code></pre>
  
  <p>I am also testing the app on a real device so there isn't any cordova or platform issue...Please tell me what mistake i am making.
  A proper description with the answer will be quite helpful for my future references.</p>