mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
Tweaks
This commit is contained in:
@ -70,7 +70,8 @@ export class Switch {
|
||||
* ControlDirective to update the value internally.
|
||||
*/
|
||||
writeValue(value) {
|
||||
this.checked = value;
|
||||
// Convert it to a boolean
|
||||
this.checked = !!value;
|
||||
}
|
||||
|
||||
|
||||
|
@ -8,10 +8,19 @@
|
||||
<ion-switch control="enableFun">
|
||||
Enable Fun?
|
||||
</ion-switch>
|
||||
|
||||
<ion-switch control="enableIceCream">
|
||||
Enable Ice Cream?
|
||||
</ion-switch>
|
||||
<ion-switch control="enablePizza">
|
||||
Enable Pizza?
|
||||
</ion-switch>
|
||||
</ion-list>
|
||||
|
||||
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>
|
||||
|
||||
</ion-content>
|
||||
|
@ -12,7 +12,9 @@ class IonicApp {
|
||||
|
||||
var fb = new FormBuilder();
|
||||
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