@@ -24,8 +24,9 @@ import {
2424 FormsModule ,
2525} from '@angular/forms' ;
2626import { CommonModule } from '@angular/common' ;
27- import { BooleanFieldValue , MdError } from '../core' ;
27+ import { MdError } from '../core' ;
2828import { Observable } from 'rxjs/Observable' ;
29+ import { coerceBooleanProperty } from '../core/coersion/boolean-property' ;
2930
3031
3132const noop = ( ) => { } ;
@@ -118,9 +119,22 @@ export class MdInput implements ControlValueAccessor, AfterContentInit, OnChange
118119 */
119120 @Input ( 'aria-label' ) ariaLabel : string ;
120121 @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 ;
122+
123+ private _ariaDisabled : boolean ;
124+ private _ariaRequired : boolean ;
125+ private _ariaInvalid : boolean ;
126+
127+ @Input ( 'aria-disabled' )
128+ get ariaDisabled ( ) : boolean { return this . _ariaDisabled ; }
129+ set ariaDisabled ( value ) { this . _ariaDisabled = coerceBooleanProperty ( value ) ; }
130+
131+ @Input ( 'aria-required' )
132+ get ariaRequired ( ) : boolean { return this . _ariaRequired ; }
133+ set ariaRequired ( value ) { this . _ariaRequired = coerceBooleanProperty ( value ) ; }
134+
135+ @Input ( 'aria-invalid' )
136+ get ariaInvalid ( ) : boolean { return this . _ariaInvalid ; }
137+ set ariaInvalid ( value ) { this . _ariaInvalid = coerceBooleanProperty ( value ) ; }
124138
125139 /**
126140 * Content directives.
@@ -141,29 +155,55 @@ export class MdInput implements ControlValueAccessor, AfterContentInit, OnChange
141155 */
142156 @Input ( ) align : 'start' | 'end' = 'start' ;
143157 @Input ( ) dividerColor : 'primary' | 'accent' | 'warn' = 'primary' ;
144- @Input ( ) @BooleanFieldValue ( ) floatingPlaceholder : boolean = true ;
145158 @Input ( ) hintLabel : string = '' ;
146159
147160 @Input ( ) autocomplete : string ;
148161 @Input ( ) autocorrect : string ;
149162 @Input ( ) autocapitalize : string ;
150- @Input ( ) @BooleanFieldValue ( ) autofocus : boolean = false ;
151- @Input ( ) @BooleanFieldValue ( ) disabled : boolean = false ;
152163 @Input ( ) id : string = `md-input-${ nextUniqueId ++ } ` ;
153164 @Input ( ) list : string = null ;
154165 @Input ( ) max : string | number = null ;
155166 @Input ( ) maxlength : number = null ;
156167 @Input ( ) min : string | number = null ;
157168 @Input ( ) minlength : number = null ;
158169 @Input ( ) placeholder : string = null ;
159- @Input ( ) @BooleanFieldValue ( ) readonly : boolean = false ;
160- @Input ( ) @BooleanFieldValue ( ) required : boolean = false ;
161- @Input ( ) @BooleanFieldValue ( ) spellcheck : boolean = false ;
162170 @Input ( ) step : number = null ;
163171 @Input ( ) tabindex : number = null ;
164172 @Input ( ) type : string = 'text' ;
165173 @Input ( ) name : string = null ;
166174
175+ private _floatingPlaceholder : boolean ;
176+ private _autofocus : boolean ;
177+ private _disabled : boolean ;
178+ private _readonly : boolean ;
179+ private _required : boolean ;
180+ private _spellcheck : boolean ;
181+
182+ @Input ( )
183+ get floatingPlaceholder ( ) : boolean { return this . _floatingPlaceholder ; }
184+ set floatingPlaceholder ( value ) { this . _floatingPlaceholder = coerceBooleanProperty ( value ) ; }
185+
186+ @Input ( )
187+ get autofocus ( ) : boolean { return this . _autofocus ; }
188+ set autofocus ( value ) { this . _autofocus = coerceBooleanProperty ( value ) ; }
189+
190+ @Input ( )
191+ get disabled ( ) : boolean { return this . _disabled ; }
192+ set disabled ( value ) { this . _disabled = coerceBooleanProperty ( value ) ; }
193+
194+ @Input ( )
195+ get readonly ( ) : boolean { return this . _readonly ; }
196+ set readonly ( value ) { this . _readonly = coerceBooleanProperty ( value ) ; }
197+
198+ @Input ( )
199+ get required ( ) : boolean { return this . _required ; }
200+ set required ( value ) { this . _required = coerceBooleanProperty ( value ) ; }
201+
202+ @Input ( )
203+ get spellcheck ( ) : boolean { return this . _spellcheck ; }
204+ set spellcheck ( value ) { this . _spellcheck = coerceBooleanProperty ( value ) ; }
205+
206+
167207 private _blurEmitter : EventEmitter < FocusEvent > = new EventEmitter < FocusEvent > ( ) ;
168208 private _focusEmitter : EventEmitter < FocusEvent > = new EventEmitter < FocusEvent > ( ) ;
169209
0 commit comments