A method I have in vue component
export default {
name: 'airport',
methods: {
async showDialogAlert(){
const alertController = document.querySelector('ion-alert-controller');
await alertController.componentOnReady();
const alert = await alertController.create({
header: 'Alert',
subHeader: 'Subtitle',
message: 'This is an alert message.',
buttons: ['OK']
});
return await alert.present();
}
}
}
Error occurs when i trigger showDialogAlert
<ion-button v-on:click="showDialogAlert">Default</ion-button>
Uncaught (in promise) TypeError: Cannot read property 'componentOnReady' of null
at VueComponent._callee$ (Airport.js?3dca:10)
at tryCatch (runtime.js?96cf:62)
at Generator.invoke [as _invoke] (runtime.js?96cf:296)
at Generator.prototype.(:8080/anonymous function) [as next] (webpack-internal:///./node_modules/regenerator-runtime/runtime.js:114:21)
at step (asyncToGenerator.js?3040:10)
at _next (asyncToGenerator.js?3040:25)
at eval (asyncToGenerator.js?3040:32)
at new Promise (<anonymous>)
at VueComponent.eval (asyncToGenerator.js?3040:5)
at VueComponent.showDialogAlert (Airport.js?3dca:33)