diff --git a/ionic/components/text-input/test/floating-labels/index.ts b/ionic/components/text-input/test/floating-labels/index.ts index 43aed36502..79de5a9b12 100644 --- a/ionic/components/text-input/test/floating-labels/index.ts +++ b/ionic/components/text-input/test/floating-labels/index.ts @@ -4,4 +4,12 @@ import {App} from 'ionic/ionic'; @App({ templateUrl: 'main.html' }) -class E2EApp {} +class E2EApp { + constructor() { + this.myValues = { + value1: 'Dynamic Input', + value2: 'Dynamic Textarea' + }; + } + +} diff --git a/ionic/components/text-input/test/floating-labels/main.html b/ionic/components/text-input/test/floating-labels/main.html index ca011371cc..24e6be3c58 100644 --- a/ionic/components/text-input/test/floating-labels/main.html +++ b/ionic/components/text-input/test/floating-labels/main.html @@ -8,10 +8,11 @@ Floating Label 1 - + + Value: {{ myValues.value1 }} - + Floating Label 2 @@ -23,8 +24,9 @@ Floating Label 4 - + + Value: {{ myValues.value2 }} Floating Label 5 diff --git a/ionic/components/text-input/text-input.ts b/ionic/components/text-input/text-input.ts index a4ae10c534..48543eea0c 100644 --- a/ionic/components/text-input/text-input.ts +++ b/ionic/components/text-input/text-input.ts @@ -1,4 +1,4 @@ -import {Component, Directive, Attribute, NgIf, forwardRef, Host, Optional, ElementRef, Renderer, Attribute} from 'angular2/angular2'; +import {Component, Directive, Attribute, NgIf, forwardRef, Host, Optional, ElementRef, Renderer, Attribute, NgControl} from 'angular2/angular2'; import {NavController} from '../nav/nav-controller'; import {Config} from '../../config/config'; @@ -469,7 +469,8 @@ export class TextInputElement { @Attribute('type') type: string, elementRef: ElementRef, renderer: Renderer, - @Optional() wrapper: TextInput + @Optional() wrapper: TextInput, + @Optional() ngControl: NgControl ) { this.type = type; this.elementRef = elementRef; @@ -484,9 +485,12 @@ export class TextInputElement { renderer.setElementClass(elementRef, 'item-input', true); wrapper.registerInput(this); } + + if (ngControl) this.ngControl = ngControl; } ngOnInit() { + if (this.ngControl) this.value = this.ngControl.value; this.wrapper && this.wrapper.hasValue(this.value); }