运行时错误未捕获(在承诺中):在离子中找不到removeView

时间:2017-11-27 09:23:56

标签: angular ionic-framework ionic3

我正在使用离子版3.15.2。调用下面的logout()方法会出现错误,指出未捕获的运行时错误(在承诺中):找不到removeView 。我在互联网上发现了类似的问题,但出现的原因各不相同。我在代码中做错了什么?

  

家庭menu.ts

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, AlertController, 
PopoverController } from 'ionic-angular';
import { AuthProvider } from '../../providers/auth/auth';

import { LoginPage } from '../login/login';


@IonicPage()
@Component({
  selector: 'page-home-menu',
templateUrl: 'home-menu.html',
})

export class HomeMenuPage {

constructor(public navCtrl: NavController, public navParams: NavParams, 
   public authData: AuthProvider,
   public alertCtrl: AlertController, private popoverCtrl: 
    PopoverController) {
}

ionViewDidLoad() {
  console.log('ionViewDidLoad HomeMenuPage');
}

logout(){
  this.authData.logoutUser()
 .then((user) => {
   let alert = this.alertCtrl.create({
    message: "You are logging out",
    buttons: [
      {
        text: "Ok",
        role: 'cancel',
        handler: () => {
          this.navCtrl.popToRoot();                  
        }
      }
    ]
  });
  alert.present();
}, (error) => {
  var errorMessage: string = error.message;
  let errorAlert = this.alertCtrl.create({
    message: errorMessage,
    buttons: [
      {
        text: "Ok",
        role: 'cancel'
      }
    ]
  });
  errorAlert.present();
 });
}

}
  

错误

Runtime Error Uncaught (in promise): removeView was not found in ionic 
  

堆栈跟踪

Error: Uncaught (in promise): removeView was not found
at c (http://localhost:8100/build/polyfills.js:3:13535)
at c (http://localhost:8100/build/polyfills.js:3:13221)
at http://localhost:8100/build/polyfills.js:3:14067
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9967)
at Object.onInvokeTask (http://localhost:8100/build/vendor.js:4499:37)
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9888)
at r.runTask (http://localhost:8100/build/polyfills.js:3:5143)
at o (http://localhost:8100/build/polyfills.js:3:2203)
at <anonymous>

0 个答案:

没有答案