Ionic 2 - inappbrowser "browser.on (...). Subscribe is not a function of" error

I follow this document http://ionicframework.com/docs/native/in-app-browser/ for using inappbrowser and try the following steps:

1- install

ionic cordova plugin add cordova-plugin-inappbrowser 

 npm install --save @ionic-native/in-app-browser

2 - add this plugin to the app.module.ts provider

3 - add to the constructor:

constructor(private iab: InAppBrowser) { }

4- and use it in the startup method as follows:

import { InAppBrowser,InAppBrowserEvent} from '@ionic-native/in-app-browser';

launch(urlc){
      let url = 'https://example.com/';
      let browser = this.iab.create(url, '_blank', 'location=yes');
      browser.on('loadstart').subscribe((ev: InAppBrowserEvent) => {
          this.close_status=true;
      });
  }

but when you use the call and call method, I see this error:

Runtime Error
browser.on(...).subscribe is not a function
+4
source share
1 answer

InAppBrowser- plugin cordova, and because of this, it is not available when you run the application in a browser with ionic serve.

/ , .

+6

Source: https://habr.com/ru/post/1678412/


All Articles