Untitled

 avatar
unknown
typescript
2 years ago
270 B
3
Indexable
  userExistsValidator(usersService: UsersService): AsyncValidatorFn  {
    return (control: AbstractControl) => {
      return usersService.findUserByEmail(control.value)
        .pipe(
            map(user => user ? {userExists:true} : null)
        );
    }
  }
Editor is loading...