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 Chuck Jazdzewski
parent 828c0d24eb
commit 6a5ba0ec81

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;
}
}