【发布时间】:2017-12-12 00:28:39
【问题描述】:
我刚开始使用离子框架。
我在我的应用程序中使用了 InAppBrowser 插件,我需要观察它上面的事件。
InAppBrowser 事件:
pageloadpagestoppageerrorexit
我已经检查了这里的文档,https://ionicframework.com/docs/native/in-app-browser/
所以,我写了我的代码:
this.browser = this.iab.create('https://www.google.com/', '_self');
this.browser.on('pageload').subscribe(
(next) => {
console.log(`pageload next: ${next}`);
},
(error) => {
console.log(`pageload error: ${error}`);
},
() => {
console.log(`pageload completed`);
}
)
...它给了我错误:
ERROR TypeError: this.browser.on(...).subscribe is not a function
at DrawPage.ionViewDidLoad (main.js:56064)
at ViewController._lifecycle (main.js:17243)
at ViewController._didLoad (main.js:17116)
at NavControllerBase._didLoad (main.js:44717)
at t.invoke (polyfills.js:3)
at Object.onInvoke (main.js:4427)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
at NgZone.run (main.js:4295)
at NavControllerBase._viewAttachToDOM (main.js:44365)
【问题讨论】:
-
你在浏览器上测试这个吗?如果是这样,请检查此线程stackoverflow.com/questions/44328762/… 无论如何,粘贴“离子信息”的输出,以便我们检查您的环境,如果您的离子版本正确。
-
@ChristianBenseler 是的,我在浏览器上测试它。我会尝试在真实设备上调试它,谢谢
标签: angular ionic-framework ionic2 observable ionic3