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-10-01 20:50:41 -04:00 committed by Victor Berchet
parent d90b622fa4
commit b55aaf094f
1 changed files with 2 additions and 2 deletions

View File

@ -121,8 +121,8 @@ export class SelectMultipleControlValueAccessor implements ControlValueAccessor
/** @internal */
_getOptionValue(valueString: string): any {
const opt = this._optionMap.get(_extractId(valueString));
return opt ? opt._value : valueString;
let key: string = _extractId(valueString);
return this._optionMap.has(key) ? this._optionMap.get(key)._value : valueString;
}
}