mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
HIT THE SWITCH
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
html {
|
||||
html, body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import {Renderer, ElementRef} from 'angular2/angular2'
|
||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
|
||||
@@ -5,7 +6,7 @@ import {IonicComponent} from 'ionic/config/component'
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'ion-list, [ion-list]'
|
||||
selector: 'ion-list'
|
||||
})
|
||||
@View({
|
||||
template: `<content></content>`
|
||||
@@ -14,8 +15,14 @@ export class List {
|
||||
constructor() {
|
||||
|
||||
}
|
||||
constructor(
|
||||
elementRef: ElementRef
|
||||
) {
|
||||
this.domElement = elementRef.domElement;
|
||||
this.config = List.config.invoke(this);
|
||||
}
|
||||
}
|
||||
|
||||
// new IonicComponent(List, {
|
||||
// propClasses: ['inset']
|
||||
// })
|
||||
new IonicComponent(List, {
|
||||
propClasses: ['inset']
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {Renderer, ElementRef} from 'angular2/angular2'
|
||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
|
||||
import {NgElement, Renderer, ElementRef, DefaultValueAccessor, Ancestor, Optional} from 'angular2/angular2'
|
||||
import {ControlGroup, ControlDirective} from 'angular2/forms'
|
||||
import {dom} from 'ionic/util';
|
||||
import {IonicComponent} from 'ionic/config/component'
|
||||
@@ -37,14 +37,14 @@ import {IonicComponent} from 'ionic/config/component'
|
||||
})
|
||||
export class Switch {
|
||||
constructor(
|
||||
@NgElement() element:NgElement,
|
||||
elementRef: ElementRef,
|
||||
cd: ControlDirective
|
||||
// @PropertySetter('attr.role') setAriaRole: Function,
|
||||
// @PropertySetter('attr.aria-checked') setChecked: Function
|
||||
// @PropertySetter('attr.aria-invalid') setInvalid: Function,
|
||||
// @PropertySetter('attr.aria-disabled') setDisabled: Function
|
||||
) {
|
||||
this.domElement = element.domElement
|
||||
this.domElement = elementRef.domElement
|
||||
this.config = Switch.config.invoke(this)
|
||||
this.controlDirective = cd;
|
||||
cd.valueAccessor = this;
|
||||
|
||||
@@ -3,12 +3,13 @@ import {Component, Directive} from 'angular2/src/core/annotations_impl/annotatio
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
|
||||
import {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/forms';
|
||||
import {IONIC_DIRECTIVES} from 'ionic/ionic'
|
||||
import {Switch, Content, Button, List} from 'ionic/ionic';
|
||||
//import {IONIC_DIRECTIVES} from 'ionic/ionic'
|
||||
|
||||
@Component({ selector: 'ion-app' })
|
||||
@View({
|
||||
templateUrl: 'main.html',
|
||||
directives: [FormDirectives].concat(IONIC_DIRECTIVES)
|
||||
directives: [FormDirectives].concat([Switch, List, Content, Button])
|
||||
})
|
||||
class IonicApp {
|
||||
constructor() {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<ion-content>
|
||||
|
||||
<form (^submit)="doSubmit($event)" [control-group]="form">
|
||||
<div class="list-header">Some Switches</div>
|
||||
|
||||
<ion-list>
|
||||
|
||||
<div class="list-header">Some Switches</div>
|
||||
<ion-switch control="enableFun">
|
||||
Enable Fun?
|
||||
</ion-switch>
|
||||
|
||||
Reference in New Issue
Block a user