Can someone explain the proper placement of the async
keyword for me? I've tried a few different spots, but keep encountering the same error.
async addNewCategory() {
let alert = this.alertCtrl.create({
title: 'New Category',
inputs: [
{
name: 'name',
placeholder: 'Category',
},
],
buttons: [
{
text: 'Cancel',
role: 'cancel',
handler: () => {
console.log('Cancel clicked');
}
},
{
text: 'Done',
handler: (data:Category) => {
if (data.name != '') {
//The error seems to be cropping up here
await this.categoryProvider.isCategoryAlreadyExist(data.name, this.projectId);
} else {
this.showToast.showErrorToast('Invalid Category');
return false;
}
}
}
]
});
alert.present();
}