我有AlertService,它调用AlertController,而alertController具有此方法,
async presentAlertPrompt() {
const alert = await this._alertController.create({
cssClass: 'my-custom-class',
header: 'Add Comment!',
inputs: [
{
name: 'comment',
type: 'textarea',
placeholder: 'Comment'
}
],
buttons: [
{
text: 'Cancel',
role: 'cancel',
cssClass: 'secondary',
handler: () => {
console.log('Confirm Cancel');
}
}, {
text: 'Ok',
handler: (alerData) => {
return alertData
}
}
]
});
await alert.present();
}
并且一旦我在另一个组件中调用此方法,
this._alert.presentAlertPrompt().then((data) => {
console.log('Alert respone',data)
})
[alertData
是空的,我在这里做错了吗?