mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(checkbox): use value accessor provider
Remove the value property and always recommend ngModel or ngControl. Closes #5353
This commit is contained in:
@@ -17,6 +17,7 @@ import {
|
||||
class E2EApp {
|
||||
fruitsForm: ControlGroup;
|
||||
grapeDisabled: boolean;
|
||||
grapeChecked: boolean;
|
||||
kiwiModel: boolean;
|
||||
strawberryModel: boolean;
|
||||
formResults: string;
|
||||
@@ -29,6 +30,7 @@ class E2EApp {
|
||||
"grapeCtrl": new Control(true)
|
||||
});
|
||||
|
||||
this.grapeChecked = true;
|
||||
this.grapeDisabled = true;
|
||||
|
||||
this.kiwiModel = false;
|
||||
@@ -36,7 +38,7 @@ class E2EApp {
|
||||
}
|
||||
|
||||
toggleGrapeChecked() {
|
||||
this.fruitsForm.controls['grapeCtrl'].updateValue( !this.fruitsForm.controls['grapeCtrl'].value )
|
||||
this.grapeChecked = !this.grapeChecked;
|
||||
}
|
||||
|
||||
toggleGrapeDisabled() {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
<ion-item>
|
||||
<ion-label>Grape, ngControl, checked, disabled</ion-label>
|
||||
<ion-toggle [disabled]="grapeDisabled" ngControl="grapeCtrl"></ion-toggle>
|
||||
<ion-toggle [checked]="grapeChecked" [disabled]="grapeDisabled" ngControl="grapeCtrl"></ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
|
||||
Reference in New Issue
Block a user