fix(forms): improve error message for invalid value accessors (#22731)

Signed-off-by: Dirk Luijk <mail@dirkluijk.nl>

PR Close #22731
This commit is contained in:
Dirk Luijk
2018-03-13 19:34:18 +01:00
committed by Alex Rickabaugh
parent 550433a128
commit 23cc3ef2eb
3 changed files with 11 additions and 1 deletions

View File

@ -187,9 +187,13 @@ export function selectValueAccessor(
dir: NgControl, valueAccessors: ControlValueAccessor[]): ControlValueAccessor|null {
if (!valueAccessors) return null;
if (!Array.isArray(valueAccessors))
_throwError(dir, 'Value accessor was not provided as an array for form control with');
let defaultAccessor: ControlValueAccessor|undefined = undefined;
let builtinAccessor: ControlValueAccessor|undefined = undefined;
let customAccessor: ControlValueAccessor|undefined = undefined;
valueAccessors.forEach((v: ControlValueAccessor) => {
if (v.constructor === DefaultValueAccessor) {
defaultAccessor = v;