@@ -237,7 +237,7 @@ export class MdcTextField extends _MdcTextFieldMixinBase implements AfterViewIni
237
237
get value ( ) : any { return this . _value ; }
238
238
set value ( newValue : any ) {
239
239
if ( ! this . _initialized ) {
240
- this . _initializeValue ( ) ;
240
+ this . ngControl ? this . _initializeValue ( ) : this . _initializeValue ( newValue ) ;
241
241
} else {
242
242
this . setValue ( newValue , true ) ;
243
243
}
@@ -289,7 +289,7 @@ export class MdcTextField extends _MdcTextFieldMixinBase implements AfterViewIni
289
289
getNativeInput : ( ) => {
290
290
return {
291
291
type : this . _type ,
292
- value : this . _value ,
292
+ value : this . _platform . isBrowser ? this . _input . nativeElement . value : this . _value ,
293
293
disabled : this . _disabled ,
294
294
validity : {
295
295
valid : this . _hasErrorState ( ) ,
@@ -464,11 +464,11 @@ export class MdcTextField extends _MdcTextFieldMixinBase implements AfterViewIni
464
464
this . _onTouched = fn ;
465
465
}
466
466
467
- private _initializeValue ( ) : void {
467
+ private _initializeValue ( value ?: any ) : void {
468
468
// Defer setting the value in order to avoid the "Expression
469
469
// has changed after it was checked" errors from Angular.
470
470
Promise . resolve ( ) . then ( ( ) => {
471
- this . setValue ( this . ngControl ? this . ngControl . value : this . _value ) ;
471
+ this . setValue ( this . ngControl ? this . ngControl . value : value ) ;
472
472
} ) ;
473
473
}
474
474
@@ -482,7 +482,7 @@ export class MdcTextField extends _MdcTextFieldMixinBase implements AfterViewIni
482
482
return ;
483
483
}
484
484
485
- this . _value = newValue ? newValue : null ;
485
+ this . _value = newValue !== undefined ? newValue : null ;
486
486
if ( this . _getInputElement ( ) . value !== this . _value ) {
487
487
this . _getInputElement ( ) . value = this . _value ;
488
488
}
0 commit comments