mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
Tweaks
This commit is contained in:
@ -70,7 +70,8 @@ export class Switch {
|
|||||||
* ControlDirective to update the value internally.
|
* ControlDirective to update the value internally.
|
||||||
*/
|
*/
|
||||||
writeValue(value) {
|
writeValue(value) {
|
||||||
this.checked = value;
|
// Convert it to a boolean
|
||||||
|
this.checked = !!value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,10 +8,19 @@
|
|||||||
<ion-switch control="enableFun">
|
<ion-switch control="enableFun">
|
||||||
Enable Fun?
|
Enable Fun?
|
||||||
</ion-switch>
|
</ion-switch>
|
||||||
|
<ion-switch control="enableIceCream">
|
||||||
|
Enable Ice Cream?
|
||||||
|
</ion-switch>
|
||||||
|
<ion-switch control="enablePizza">
|
||||||
|
Enable Pizza?
|
||||||
|
</ion-switch>
|
||||||
</ion-list>
|
</ion-list>
|
||||||
|
|
||||||
Is fun enabled? <b>{{form.controls.enableFun.value}}</b>
|
Is fun enabled? <b>{{form.controls.enableFun.value}}</b>
|
||||||
|
<br>
|
||||||
|
Is ice cream enabled? <b>{{form.controls.enableIceCream.value}}</b>
|
||||||
|
<br>
|
||||||
|
Is pizza enabled? <b>{{form.controls.enablePizza.value}}</b>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
@ -12,7 +12,9 @@ class IonicApp {
|
|||||||
|
|
||||||
var fb = new FormBuilder();
|
var fb = new FormBuilder();
|
||||||
this.form = fb.group({
|
this.form = fb.group({
|
||||||
enableFun: ['', Validators.required]
|
enableFun: ['', Validators.required],
|
||||||
|
enableIceCream: [false, Validators.required],
|
||||||
|
enablePizza: [true, Validators.required]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user