1
- import { Component , Optional , ElementRef } from 'angular2/core' ;
1
+ import { Component , Optional , ElementRef , ViewChild } from 'angular2/core' ;
2
2
import { NgIf , NgControl } from 'angular2/common' ;
3
3
4
4
import { Button } from '../button/button' ;
@@ -65,7 +65,7 @@ import {Platform} from '../../platform/platform';
65
65
@Component ( {
66
66
selector : 'ion-input' ,
67
67
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">' +
69
69
'<input [type]="type" aria-hidden="true" next-input *ngIf="_useAssist">' +
70
70
'<button clear *ngIf="clearInput && value" class="text-input-clear-icon" (click)="clearTextInput()" (mousedown)="clearTextInput()"></button>' +
71
71
'<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 {
90
90
) {
91
91
super ( config , form , item , app , platform , elementRef , scrollView , nav , ngControl ) ;
92
92
}
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
+ }
93
107
}
94
108
95
109
@@ -134,7 +148,7 @@ export class TextInput extends InputBase {
134
148
@Component ( {
135
149
selector : 'ion-textarea' ,
136
150
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>' +
138
152
'<input type="text" aria-hidden="true" next-input *ngIf="_useAssist">' +
139
153
'<div (touchstart)="pointerStart($event)" (touchend)="pointerEnd($event)" (mousedown)="pointerStart($event)" (mouseup)="pointerEnd($event)" class="input-cover" tappable *ngIf="_useAssist"></div>' ,
140
154
directives : [
@@ -167,4 +181,18 @@ export class TextArea extends InputBase {
167
181
this . _item . setCssClass ( 'item-textarea' , true ) ;
168
182
}
169
183
}
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
+ }
170
198
}
0 commit comments