关闭 InAppBrowser 后,我无法移动到下一页
After closing InAppBrowser, I am not able to move to next page
我一直面临 ionic 3 中的 inappbrowser 问题。在下面的代码中,如果付款成功,我想转到 Thankyoupage,否则它必须留在同一页面上。付款成功或失败后,关闭应用程序浏览器后,它会返回同一页面。我可以调用 this.navCtrl.push(ThankyouPage)。我看到未定义的异常。谁能指导我理解,我在哪里犯了错误
let option = 'location=no,hidden=yes';
let url = "https://www.example.com/pay;
const browser = this.inappBrowser.create(url,option);
browser.on('loadstart').subscribe(function(event) {
if(event.url== "https://www.example.net/success.php"){
browser.close();
//failuring here
this.navCtrl.push(ThankyouPage);
}
if(event.url== "https://www.example.net/failure.php"){
browser.close();
}
});
let self=this; // add this line
let option = 'location=no,hidden=yes';
let url = "https://www.example.com/pay;
const browser = this.inappBrowser.create(url,option);
browser.on('loadstart').subscribe(function(event) {
if(event.url== "https://www.example.net/success.php"){
browser.close();
//failuring here
self.navCtrl.push(ThankyouPage); // Update this statement
//self.navCtrl.push('ThankyouPage'); // Uncomment this if you use lazyloading
}
if(event.url== "https://www.example.net/failure.php"){
browser.close();
}
});
我一直面临 ionic 3 中的 inappbrowser 问题。在下面的代码中,如果付款成功,我想转到 Thankyoupage,否则它必须留在同一页面上。付款成功或失败后,关闭应用程序浏览器后,它会返回同一页面。我可以调用 this.navCtrl.push(ThankyouPage)。我看到未定义的异常。谁能指导我理解,我在哪里犯了错误
let option = 'location=no,hidden=yes';
let url = "https://www.example.com/pay;
const browser = this.inappBrowser.create(url,option);
browser.on('loadstart').subscribe(function(event) {
if(event.url== "https://www.example.net/success.php"){
browser.close();
//failuring here
this.navCtrl.push(ThankyouPage);
}
if(event.url== "https://www.example.net/failure.php"){
browser.close();
}
});
let self=this; // add this line
let option = 'location=no,hidden=yes';
let url = "https://www.example.com/pay;
const browser = this.inappBrowser.create(url,option);
browser.on('loadstart').subscribe(function(event) {
if(event.url== "https://www.example.net/success.php"){
browser.close();
//failuring here
self.navCtrl.push(ThankyouPage); // Update this statement
//self.navCtrl.push('ThankyouPage'); // Uncomment this if you use lazyloading
}
if(event.url== "https://www.example.net/failure.php"){
browser.close();
}
});