NG_ASYNC_VALIDATORS
상수
안정화
An InjectionToken for registering additional asynchronous validators used with
AbstractControls.
사용 시 참고사항
Provide a custom async validator directive
The following example implements the AsyncValidator interface to create an
async validator directive with a custom error key.
@Directive({
selector: '[customAsyncValidator]',
providers: [{provide: NG_ASYNC_VALIDATORS, useExisting: CustomAsyncValidatorDirective, multi:
true}]
})
class CustomAsyncValidatorDirective implements AsyncValidator {
validate(control: AbstractControl): Promise<ValidationErrors|null> {
return Promise.resolve({'custom': true});
}
}
상세 내용으로 이동