Ionic2 AlertController 2未捕获类型错误:无法读取属性';创建';未定义的
我试图在退出应用程序时进行验证,但在使用AlertController ionic 2:时遇到错误,我按照 对不起,我英语不好 我的错误:Ionic2 AlertController 2未捕获类型错误:无法读取属性';创建';未定义的,ionic2,Ionic2,我试图在退出应用程序时进行验证,但在使用AlertController ionic 2:时遇到错误,我按照 对不起,我英语不好 我的错误: Uncaught TypeError: Cannot read property 'create' of undefined at Object.MyApp.exit [as fn] (main.js:143575) at Platform.runBackButtonAction (main.js:2347) at main.js:2022 at SafeS
Uncaught TypeError: Cannot read property 'create' of undefined
at Object.MyApp.exit [as fn] (main.js:143575)
at Platform.runBackButtonAction (main.js:2347)
at main.js:2022
at SafeSubscriber.schedulerFn [as _next] (main.js:54953)
at SafeSubscriber.__tryOrUnsub (main.js:1388)
at SafeSubscriber.next (main.js:1337)
at Subscriber._next (main.js:1290)
at Subscriber.next (main.js:1254)
at EventEmitter.Subject.next (main.js:7763)
at EventEmitter.emit (main.js:54927)
at main.js:104021
at t.invoke (polyfills.js:3)
at Object.onInvoke (main.js:38895)
at t.invoke (polyfills.js:3)
at e.run (polyfills.js:3)
我的代码app.component.ts:
试试这段代码
exit(){
this.alertCtrl.create({
title :'' ,
subTitle:'',
buttons:['']
}).then(alertEt =>{
alertEt.present();
})
}
试试这个