My ionic app is up and running, utilizing a template driven form in Angular to gather user input. I'm using ngSubmit to pass this data to my ts.file. My challenge lies in triggering the ngSubmit function through a 'No and save data' button within an alert. The alert function is separate from my html.file, leaving me unsure of how to pass data to the alert function or activate ngSubmit via the alert.
html.file
<form #observeForm="ngForm" (ngSubmit)="onSubmit(observeForm.value)" [(observeForm.value)]="tester">
...
<ion-button margin-top="auto" expand="block" type="submit" routerDirection="backforward">Confirm</ion-button>
</form>
ts.file
async presentAlertConfirm() {
const alert = await this.alertController.create({
header: 'Time Out!',
message: 'Do you want to add more observe time?',
buttons: [
{
text: 'Yes',
cssClass: 'secondary',
handler: () => {
this.startTimer();
console.log('Add time Okay');
}
},
{
text: 'No and save data',
role: 'cancel',
cssClass: 'secondary',
handler: (blah) => {
this.timer = 0;
}
}
]
});
await alert.present();
}