离子切换(ngModelChange)打印错误的输出
Ion-toggle (ngModelChange) prints wrong output
这是我的 .html 文件
<ion-item no-lines (click)="update()" >
<ion-label> Notification</ion-label>
<ion-toggle [(ngModel)]="notify" (ngModelChange)="update()"></ion-toggle>
</ion-item>
这是我的 .ts 文件
notify:boolean = true;
update(){
consol.log(this.notify);
}
when i click on the Notification
text i am printing true
When i click on the ion-toggle
it prints me false
当我点击 ion-toggle 时,它会打印出与布尔值相反的内容,但我不会改变关于这个问题的任何想法。
尝试remove/rename
中的功能更新
<ion-toggle [(ngModel)]="notify" (ngModelChange)="update()"></ion-toggle>
这是我的 .html 文件
<ion-item no-lines (click)="update()" >
<ion-label> Notification</ion-label>
<ion-toggle [(ngModel)]="notify" (ngModelChange)="update()"></ion-toggle>
</ion-item>
这是我的 .ts 文件
notify:boolean = true;
update(){
consol.log(this.notify);
}
when i click on the
Notification
text i am printingtrue
When i click on the
ion-toggle
it prints mefalse
当我点击 ion-toggle 时,它会打印出与布尔值相反的内容,但我不会改变关于这个问题的任何想法。
尝试remove/rename
中的功能更新<ion-toggle [(ngModel)]="notify" (ngModelChange)="update()"></ion-toggle>