Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 离子2寄存器BackButton功能不工作_Angular_Typescript_Ionic2_Ionic View - Fatal编程技术网

Angular 离子2寄存器BackButton功能不工作

Angular 离子2寄存器BackButton功能不工作,angular,typescript,ionic2,ionic-view,Angular,Typescript,Ionic2,Ionic View,我的app.component.ts有以下代码 @ViewChild(Nav) nav: Nav; constructor(public platform: Platform, public statusBar: StatusBar, private toastService: ToastService, public app: App) { this.platform.ready().then(() => { this.statusBar.styleDefault();

我的app.component.ts有以下代码

@ViewChild(Nav) nav: Nav;
constructor(public platform: Platform, public statusBar: StatusBar,
    private toastService: ToastService, public app: App) {  
 this.platform.ready().then(() => {
  this.statusBar.styleDefault();
  this.splashScreen.hide();

  this.platform.registerBackButtonAction(() => {
      let view = this.nav.getActive().name;
      console.log('view:', view);
      if (view === "HomeComponent")
        this.platform.exitApp();
      else
        this.toastService.presentToast(new ToastModel("back button pressed"))
  })
});

openPage(page) {
    this.nav.push(page.component);   
}
但当按下后退按钮时,应用程序关闭,尽管不在HomeComponent上 在对registerBackButton函数进行调试时,控制台上没有错误 我们正在使用的平台实例中未列出此函数

非常感谢您的帮助。

我找到了解决方案:

将googlemaps插件降级至1.4版

爱奥尼亚科尔多瓦插件添加科尔多瓦插件谷歌地图-变量

但是

爱奥尼亚医生有:
爱奥尼亚cordova插件添加…您使用的是
选项卡
模板还是?调试模式下显示什么?是。使用选项卡模板。在调试模式下没有这样的错误。虽然当我尝试寻找平台实例时。registerBackButton未显示为函数。在调试模式下,此
let view=this.nav.getActive().name的值是多少?@Sampath如何在设备上执行此操作?我是新手。你能告诉我怎么做吗??模拟?连接到USB端口时可以使用此选项<代码>爱奥尼亚cordova运行安卓--prod--device