1- import { Component , Optional , ElementRef } from 'angular2/core' ;
1+ import { Component , Optional , ElementRef , ViewChild } from 'angular2/core' ;
22import { NgIf , NgControl } from 'angular2/common' ;
33
44import { Button } from '../button/button' ;
@@ -65,7 +65,7 @@ import {Platform} from '../../platform/platform';
6565@Component ( {
6666 selector : 'ion-input' ,
6767 template :
68- '<input [type]="type" [(ngModel)]="_value" [placeholder]="placeholder" class="text-input">' +
68+ '<input [type]="type" [(ngModel)]="_value" (blur)="inputBlurred($event)" (focus)="inputFocused($event)" [placeholder]="placeholder" class="text-input">' +
6969 '<input [type]="type" aria-hidden="true" next-input *ngIf="_useAssist">' +
7070 '<button clear *ngIf="clearInput && value" class="text-input-clear-icon" (click)="clearTextInput()" (mousedown)="clearTextInput()"></button>' +
7171 '<div (touchstart)="pointerStart($event)" (touchend)="pointerEnd($event)" (mousedown)="pointerStart($event)" (mouseup)="pointerEnd($event)" class="input-cover" tappable *ngIf="_useAssist"></div>' ,
@@ -90,6 +90,20 @@ export class TextInput extends InputBase {
9090 ) {
9191 super ( config , form , item , app , platform , elementRef , scrollView , nav , ngControl ) ;
9292 }
93+
94+ /**
95+ * @private
96+ */
97+ inputBlurred ( event ) {
98+ this . blur . emit ( event ) ;
99+ }
100+
101+ /**
102+ * @private
103+ */
104+ inputFocused ( event ) {
105+ this . focus . emit ( event ) ;
106+ }
93107}
94108
95109
@@ -134,7 +148,7 @@ export class TextInput extends InputBase {
134148@Component ( {
135149 selector : 'ion-textarea' ,
136150 template :
137- '<textarea [(ngModel)]="_value" [placeholder]="placeholder" class="text-input"></textarea>' +
151+ '<textarea [(ngModel)]="_value" (blur)="inputBlurred($event)" (focus)="inputFocused($event)" [placeholder]="placeholder" class="text-input"></textarea>' +
138152 '<input type="text" aria-hidden="true" next-input *ngIf="_useAssist">' +
139153 '<div (touchstart)="pointerStart($event)" (touchend)="pointerEnd($event)" (mousedown)="pointerStart($event)" (mouseup)="pointerEnd($event)" class="input-cover" tappable *ngIf="_useAssist"></div>' ,
140154 directives : [
@@ -167,4 +181,18 @@ export class TextArea extends InputBase {
167181 this . _item . setCssClass ( 'item-textarea' , true ) ;
168182 }
169183 }
184+
185+ /**
186+ * @private
187+ */
188+ inputBlurred ( event ) {
189+ this . blur . emit ( event ) ;
190+ }
191+
192+ /**
193+ * @private
194+ */
195+ inputFocused ( event ) {
196+ this . focus . emit ( event ) ;
197+ }
170198}
0 commit comments