MCPcopy
hub / github.com/angular/angular / simpleAsyncValidator

Function simpleAsyncValidator

packages/forms/test/util.ts:56–70  ·  view source on GitHub ↗
({
  timeout = 0,
  shouldFail,
  customError = {
    async: true,
  },
}: {
  timeout?: number;
  shouldFail: boolean;
  customError?: any;
})

Source from the content-addressed store, hash-verified

54 * @param customError When supplied, overrides the default error `{async: true}`
55 */
56export function simpleAsyncValidator({
57 timeout = 0,
58 shouldFail,
59 customError = {
60 async: true,
61 },
62}: {
63 timeout?: number;
64 shouldFail: boolean;
65 customError?: any;
66}): AsyncValidatorFn {
67 const result = shouldFail ? customError : null;
68 return (c: AbstractControl) =>
69 timeout === 0 ? of(result) : createValidationPromise(result, timeout);
70}
71
72/**
73 * Returns the asynchronous validation state of each provided control

Callers 1

form_group_spec.tsFile · 0.90

Calls 1

createValidationPromiseFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…