fix(forms): select shows blank line when nothing is selected in IE/Edge (#13903)

Closes #10010

PR Close #13903
This commit is contained in:
Dzmitry Shylovich 2017-01-13 01:41:49 +03:00 committed by Miško Hevery
parent c5ea03a023
commit 029f558d45
1 changed files with 5 additions and 1 deletions

View File

@ -86,7 +86,11 @@ export class SelectControlValueAccessor implements ControlValueAccessor {
writeValue(value: any): void { writeValue(value: any): void {
this.value = value; this.value = value;
const valueString = _buildValueString(this._getOptionId(value), value); const id: string = this._getOptionId(value);
if (id == null) {
this._renderer.setElementProperty(this._elementRef.nativeElement, 'selectedIndex', -1);
}
const valueString = _buildValueString(id, value);
this._renderer.setElementProperty(this._elementRef.nativeElement, 'value', valueString); this._renderer.setElementProperty(this._elementRef.nativeElement, 'value', valueString);
} }