@@ -80,8 +80,8 @@ import { Platform } from '../../platform/platform';
80
80
@Component ( {
81
81
selector : 'ion-input,ion-textarea' ,
82
82
template :
83
- '<input [(ngModel)]="_value" [type]="type" (blur)="inputBlurred($event)" (focus)="inputFocused($event)" [placeholder]="placeholder" [disabled]="disabled" class="text-input" [ngClass]="\'text-input-\' + _mode" *ngIf="_type!==\'textarea\'" #input>' +
84
- '<textarea [(ngModel)]="_value" (blur)="inputBlurred($event)" (focus)="inputFocused($event)" [placeholder]="placeholder" [disabled]="disabled" class="text-input" [ngClass]="\'text-input-\' + _mode" *ngIf="_type===\'textarea\'" #textarea></textarea>' +
83
+ '<input [(ngModel)]="_value" [type]="type" (blur)="inputBlurred($event)" (focus)="inputFocused($event)" [placeholder]="placeholder" [disabled]="disabled" [readonly]="readonly" class="text-input" [ngClass]="\'text-input-\' + _mode" *ngIf="_type!==\'textarea\'" #input>' +
84
+ '<textarea [(ngModel)]="_value" (blur)="inputBlurred($event)" (focus)="inputFocused($event)" [placeholder]="placeholder" [disabled]="disabled" [readonly]="readonly" class="text-input" [ngClass]="\'text-input-\' + _mode" *ngIf="_type===\'textarea\'" #textarea></textarea>' +
85
85
'<input [type]="type" aria-hidden="true" next-input *ngIf="_useAssist">' +
86
86
'<button ion-button clear [hidden]="!clearInput" type="button" class="text-input-clear-icon" (click)="clearTextInput()" (mousedown)="clearTextInput()"></button>' +
87
87
'<div (touchstart)="pointerStart($event)" (touchend)="pointerEnd($event)" (mousedown)="pointerStart($event)" (mouseup)="pointerEnd($event)" class="input-cover" tappable *ngIf="_useAssist"></div>' ,
@@ -96,6 +96,7 @@ export class TextInput extends Ion implements IonicFormInput {
96
96
_coord : PointerCoordinates ;
97
97
_didBlurAfterEdit : boolean ;
98
98
_disabled : boolean = false ;
99
+ _readonly : boolean = false ;
99
100
_isTouch : boolean ;
100
101
_keyboardHeight : number ;
101
102
_native : NativeInput ;
@@ -164,7 +165,7 @@ export class TextInput extends Ion implements IonicFormInput {
164
165
@Input ( ) placeholder : string = '' ;
165
166
166
167
/**
167
- * @input {bool } A clear icon will appear in the input when there is a value. Clicking it clears the input.
168
+ * @input {boolean } A clear icon will appear in the input when there is a value. Clicking it clears the input.
168
169
*/
169
170
@Input ( )
170
171
get clearInput ( ) {
@@ -208,7 +209,7 @@ export class TextInput extends Ion implements IonicFormInput {
208
209
}
209
210
210
211
/**
211
- * @input {bool } If the input should be disabled or not
212
+ * @input {boolean } If the input should be disabled or not
212
213
*/
213
214
@Input ( )
214
215
get disabled ( ) {
@@ -226,6 +227,17 @@ export class TextInput extends Ion implements IonicFormInput {
226
227
this . _native && this . _native . isDisabled ( val ) ;
227
228
}
228
229
230
+ /**
231
+ * @input {boolean} If the input should be readonly or not
232
+ */
233
+ @Input ( )
234
+ get readonly ( ) {
235
+ return this . _readonly ;
236
+ }
237
+ set readonly ( val : boolean ) {
238
+ this . _readonly = isTrueProperty ( val ) ;
239
+ }
240
+
229
241
/**
230
242
* @input {string} The mode to apply to this component.
231
243
*/
0 commit comments