diff --git a/ionic/components.ts b/ionic/components.ts index d768049511..19f64eec56 100644 --- a/ionic/components.ts +++ b/ionic/components.ts @@ -9,6 +9,7 @@ export * from 'ionic/components/item/item' export * from 'ionic/components/item/item-group' export * from 'ionic/components/form/form' export * from 'ionic/components/form/text-input' +export * from 'ionic/components/form/tap-input' export * from 'ionic/components/form/label' export * from 'ionic/components/list/list' export * from 'ionic/components/modal/modal' diff --git a/ionic/components/checkbox/checkbox.ts b/ionic/components/checkbox/checkbox.ts index b163d254dd..8cbf66a771 100644 --- a/ionic/components/checkbox/checkbox.ts +++ b/ionic/components/checkbox/checkbox.ts @@ -8,6 +8,7 @@ import { } from 'angular2/angular2'; import {Ion} from '../ion'; +import {IonInputContainer} from '../form/form'; import {IonicConfig} from '../../config/config'; import {IonicComponent, IonicView} from '../../config/annotations'; import {Icon} from '../icon/icon'; @@ -34,7 +35,7 @@ import {Icon} from '../icon/icon'; '' + '' }) -export class Checkbox extends Ion { +export class Checkbox extends IonInputContainer { _checkbox: CheckboxInput; @@ -52,7 +53,7 @@ export class Checkbox extends Ion { } } - registerCheckbox(checkboxDir) { + registerInput(checkboxDir) { if (this._checkbox != null) { throw 'Only one is allowed per ' } @@ -73,17 +74,15 @@ export class Checkbox extends Ion { } } -@Directive({ - selector: 'input[type=checkbox]' -}) -export class CheckboxInput { - constructor( - elementRef: ElementRef, - @Optional() @Parent() container: Checkbox, - @Optional() control: NgControl - ) { - this.elementRef = elementRef; - this.control = control ? control : null; - container && container.registerCheckbox(this); - } -} + +// export class CheckboxInput { +// constructor( +// elementRef: ElementRef, +// @Optional() @Parent() container: Checkbox, +// @Optional() control: NgControl +// ) { +// this.elementRef = elementRef; +// this.control = control ? control : null; +// container && container.registerCheckbox(this); +// } +// } diff --git a/ionic/components/form/tap-input.ts b/ionic/components/form/tap-input.ts index 72001a0901..c321907860 100644 --- a/ionic/components/form/tap-input.ts +++ b/ionic/components/form/tap-input.ts @@ -1,13 +1,16 @@ -import {Parent, Ancestor, Optional, ElementRef, Attribute} from 'angular2/angular2'; +import {Parent, Ancestor, Optional, ElementRef, Attribute, Directive} from 'angular2/angular2'; import {IonInput} from './form'; import {IonicApp} from '../app/app'; import {Content} from '../content/content'; +import {Checkbox} from '../checkbox/checkbox'; - +@Directive({ + selector: 'input[type=checkbox],input[type=radio]' +}) export class TapInput extends IonInput { constructor( - @Optional() @Parent() container: Input, + @Optional() @Parent() container: Checkbox, //TODO have this be either Checkbox or Radio @Optional() @Ancestor() scrollView: Content, @Attribute('type') type: string, elementRef: ElementRef, diff --git a/ionic/config/annotations.ts b/ionic/config/annotations.ts index 8a9f301660..c2c0221d98 100644 --- a/ionic/config/annotations.ts +++ b/ionic/config/annotations.ts @@ -11,7 +11,7 @@ import { List, Item, ItemGroup, ItemGroupTitle, Toolbar, Icon, - Checkbox, CheckboxInput, Switch, + Checkbox, TapInput, Switch, Input, TextInput, Label, Segment, SegmentButton, SegmentControlValueAccessor, RadioGroup, RadioButton, SearchBar, @@ -56,13 +56,13 @@ export const IonicDirectives = [ forwardRef(() => SegmentButton), forwardRef(() => SegmentControlValueAccessor), forwardRef(() => Checkbox), - forwardRef(() => CheckboxInput), //Checkbox, Switch //RadioGroup, RadioButton, SearchBar, // Input forwardRef(() => Input), forwardRef(() => TextInput), + forwardRef(() => TapInput), forwardRef(() => Label), // Nav