form-example
form-example copied to clipboard
Can't use async validators, Object doesn't support property or method 'map'
In validate.ts:
return asyncValidator(control).map(v => {
const secondary = synchronousValid();
if (secondary || v) { // compose async and sync validator results
return Object.assign({}, secondary, v);
}
});
asyncValidator(control)
is not an array
My validator looks like this:
...
@Directive({
selector: "[selector-name][ngModel]",
providers: [
{
provide: NG_ASYNC_VALIDATORS, useExisting: SelectorClass, multi: true
}
]
})
export class SelectorClass implements Validator {
...
same issue, my build fails with the source code provided
anyone found a solution?
We ended up moving to reactive forms when we couldn't figure out how to do nested forms/validation with ngModel
@benjamin-wilson did you try this out https://github.com/GFoley83/form-example/tree/feature/support-reactive-form