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:

committed by
Alex Rickabaugh

parent
550433a128
commit
23cc3ef2eb
@ -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;
|
||||
|
Reference in New Issue
Block a user