mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Switch compiles
This commit is contained in:
@@ -1,26 +1,15 @@
|
||||
<ion-content>
|
||||
|
||||
<ion-view nav-title="Switches">
|
||||
|
||||
<ion-content>
|
||||
|
||||
<form (^submit)="doSubmit($event)" [control-group]="form">
|
||||
<div class="list-header">Some Switches</div>
|
||||
|
||||
<ion-list>
|
||||
|
||||
<ion-switch [checked]="true">
|
||||
Apples
|
||||
</ion-switch>
|
||||
|
||||
<ion-switch>
|
||||
Bananas
|
||||
</ion-switch>
|
||||
|
||||
<ion-switch [disabled]="true">
|
||||
Oranges
|
||||
<ion-switch control="enableFun">
|
||||
Enable Fun?
|
||||
</ion-switch>
|
||||
|
||||
</ion-list>
|
||||
</form>
|
||||
|
||||
</ion-content>
|
||||
|
||||
</ion-view>
|
||||
</ion-content>
|
||||
|
||||
@@ -1,16 +1,24 @@
|
||||
import {Component, View, bootstrap} from 'angular2/angular2';
|
||||
import {Content} from 'ionic/components/content/content';
|
||||
import {Switch} from 'ionic/components/switch/switch';
|
||||
import {List} from 'ionic/components/list/list';
|
||||
import {Component, View, bootstrap} from 'angular2/angular2'
|
||||
import {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/forms';
|
||||
import {IONIC_DIRECTIVES} from 'ionic/ionic'
|
||||
|
||||
@Component({ selector: '[ion-app]' })
|
||||
@View({
|
||||
templateUrl: 'main.html',
|
||||
directives: [Content, Switch, List]
|
||||
directives: [FormDirectives].concat(IONIC_DIRECTIVES)
|
||||
})
|
||||
class IonicApp {
|
||||
constructor() {
|
||||
console.log('IonicApp Start')
|
||||
|
||||
var fb = new FormBuilder();
|
||||
this.form = fb.group({
|
||||
enableFun: ['', Validators.required]
|
||||
});
|
||||
}
|
||||
|
||||
doSubmit(event) {
|
||||
console.log('Submitting form', this.form.value);
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user