aquí está mi archivo .html
<ion-item no-lines (click)="update()" > <ion-label> Notification</ion-label> <ion-toggle [(ngModel)]="notify" ></ion-toggle> </ion-item> el código anterior funciona cuando hago clic en el texto de Notification , pero cuando hago clic en el ion-toggle no puedo invocar la función, ¿qué debo hacer para invocar la función?
aquí está mi archivo .ts
update(){ console.log("invoking notification"); }Si usa ngModel , es mejor usar ngModelChange
<ion-toggle [(ngModel)]="notify" (ngModelChange)="update($event)" ></ion-toggle>de lo contrario, puedes usar
<ion-toggle (ionChange)="update($event)"></ion-toggle>Consulte también https://ionicframework.com/docs/api/components/toggle/Toggle/