fix: allow for null values in HTML select options bound with ngValue

This corrects the case of <option [ngValue]="null"> binding a string like "{0: null}" to the model instead of an actual null object.

Closes #10349
This commit is contained in:
Craig Hutchison 2016-09-30 23:10:21 -04:00 committed by Victor Berchet
parent 79e2bb9291
commit d90b622fa4
1 changed files with 2 additions and 2 deletions

View File

@ -115,8 +115,8 @@ export class SelectControlValueAccessor implements ControlValueAccessor {
/** @internal */
_getOptionValue(valueString: string): any {
const value = this._optionMap.get(_extractId(valueString));
return value != null ? value : valueString;
let key: string = _extractId(valueString);
return this._optionMap.has(key) ? this._optionMap.get(key) : valueString;
}
}