@@ -18,13 +18,9 @@ import {
1818 ModuleWithProviders ,
1919 ViewEncapsulation ,
2020} from '@angular/core' ;
21- import {
22- NG_VALUE_ACCESSOR ,
23- ControlValueAccessor ,
24- FormsModule ,
25- } from '@angular/forms' ;
21+ import { NG_VALUE_ACCESSOR , ControlValueAccessor , FormsModule } from '@angular/forms' ;
2622import { CommonModule } from '@angular/common' ;
27- import { BooleanFieldValue , MdError } from '../core' ;
23+ import { MdError , coerceBooleanProperty } from '../core' ;
2824import { Observable } from 'rxjs/Observable' ;
2925
3026
@@ -118,9 +114,22 @@ export class MdInput implements ControlValueAccessor, AfterContentInit, OnChange
118114 */
119115 @Input ( 'aria-label' ) ariaLabel : string ;
120116 @Input ( 'aria-labelledby' ) ariaLabelledBy : string ;
121- @Input ( 'aria-disabled' ) @BooleanFieldValue ( ) ariaDisabled : boolean ;
122- @Input ( 'aria-required' ) @BooleanFieldValue ( ) ariaRequired : boolean ;
123- @Input ( 'aria-invalid' ) @BooleanFieldValue ( ) ariaInvalid : boolean ;
117+
118+ private _ariaDisabled : boolean ;
119+ private _ariaRequired : boolean ;
120+ private _ariaInvalid : boolean ;
121+
122+ @Input ( 'aria-disabled' )
123+ get ariaDisabled ( ) : boolean { return this . _ariaDisabled ; }
124+ set ariaDisabled ( value ) { this . _ariaDisabled = coerceBooleanProperty ( value ) ; }
125+
126+ @Input ( 'aria-required' )
127+ get ariaRequired ( ) : boolean { return this . _ariaRequired ; }
128+ set ariaRequired ( value ) { this . _ariaRequired = coerceBooleanProperty ( value ) ; }
129+
130+ @Input ( 'aria-invalid' )
131+ get ariaInvalid ( ) : boolean { return this . _ariaInvalid ; }
132+ set ariaInvalid ( value ) { this . _ariaInvalid = coerceBooleanProperty ( value ) ; }
124133
125134 /**
126135 * Content directives.
@@ -141,29 +150,55 @@ export class MdInput implements ControlValueAccessor, AfterContentInit, OnChange
141150 */
142151 @Input ( ) align : 'start' | 'end' = 'start' ;
143152 @Input ( ) dividerColor : 'primary' | 'accent' | 'warn' = 'primary' ;
144- @Input ( ) @BooleanFieldValue ( ) floatingPlaceholder : boolean = true ;
145153 @Input ( ) hintLabel : string = '' ;
146154
147155 @Input ( ) autocomplete : string ;
148156 @Input ( ) autocorrect : string ;
149157 @Input ( ) autocapitalize : string ;
150- @Input ( ) @BooleanFieldValue ( ) autofocus : boolean = false ;
151- @Input ( ) @BooleanFieldValue ( ) disabled : boolean = false ;
152158 @Input ( ) id : string = `md-input-${ nextUniqueId ++ } ` ;
153159 @Input ( ) list : string = null ;
154160 @Input ( ) max : string | number = null ;
155161 @Input ( ) maxlength : number = null ;
156162 @Input ( ) min : string | number = null ;
157163 @Input ( ) minlength : number = null ;
158164 @Input ( ) placeholder : string = null ;
159- @Input ( ) @BooleanFieldValue ( ) readonly : boolean = false ;
160- @Input ( ) @BooleanFieldValue ( ) required : boolean = false ;
161- @Input ( ) @BooleanFieldValue ( ) spellcheck : boolean = false ;
162165 @Input ( ) step : number = null ;
163166 @Input ( ) tabindex : number = null ;
164167 @Input ( ) type : string = 'text' ;
165168 @Input ( ) name : string = null ;
166169
170+ private _floatingPlaceholder : boolean = false ;
171+ private _autofocus : boolean = false ;
172+ private _disabled : boolean = false ;
173+ private _readonly : boolean = false ;
174+ private _required : boolean = false ;
175+ private _spellcheck : boolean = false ;
176+
177+ @Input ( )
178+ get floatingPlaceholder ( ) : boolean { return this . _floatingPlaceholder ; }
179+ set floatingPlaceholder ( value ) { this . _floatingPlaceholder = coerceBooleanProperty ( value ) ; }
180+
181+ @Input ( )
182+ get autofocus ( ) : boolean { return this . _autofocus ; }
183+ set autofocus ( value ) { this . _autofocus = coerceBooleanProperty ( value ) ; }
184+
185+ @Input ( )
186+ get disabled ( ) : boolean { return this . _disabled ; }
187+ set disabled ( value ) { this . _disabled = coerceBooleanProperty ( value ) ; }
188+
189+ @Input ( )
190+ get readonly ( ) : boolean { return this . _readonly ; }
191+ set readonly ( value ) { this . _readonly = coerceBooleanProperty ( value ) ; }
192+
193+ @Input ( )
194+ get required ( ) : boolean { return this . _required ; }
195+ set required ( value ) { this . _required = coerceBooleanProperty ( value ) ; }
196+
197+ @Input ( )
198+ get spellcheck ( ) : boolean { return this . _spellcheck ; }
199+ set spellcheck ( value ) { this . _spellcheck = coerceBooleanProperty ( value ) ; }
200+
201+
167202 private _blurEmitter : EventEmitter < FocusEvent > = new EventEmitter < FocusEvent > ( ) ;
168203 private _focusEmitter : EventEmitter < FocusEvent > = new EventEmitter < FocusEvent > ( ) ;
169204
0 commit comments