MCPcopy Create free account
hub / github.com/angular/angular / createValidatorClass

Function createValidatorClass

packages/forms/test/reactive_integration_spec.ts:74–91  ·  view source on GitHub ↗
(selector: string)

Source from the content-addressed store, hash-verified

72
73// Produces a new @Directive (with a given selector) that represents a validator class.
74function createValidatorClass(selector: string) {
75 @Directive({
76 selector,
77 providers: [
78 {
79 provide: NG_VALIDATORS,
80 useClass: forwardRef(() => CustomValidator),
81 multi: true,
82 },
83 ],
84 })
85 class CustomValidator implements Validator {
86 validate(control: AbstractControl) {
87 return null;
88 }
89 }
90 return CustomValidator;
91}
92
93// Produces a new @Directive (with a given selector) that represents an async validator class.
94function createAsyncValidatorClass(selector: string) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected