docs(forms): Update catchError to return an `observable` (#34357)
Closes #34323 PR Close #34357
This commit is contained in:
parent
6ce940315b
commit
5f2897be0b
|
@ -7,7 +7,7 @@ import {
|
|||
} from '@angular/forms';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { HeroesService } from './heroes.service';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Observable, of } from 'rxjs';
|
||||
|
||||
// #docregion async-validator
|
||||
@Injectable({ providedIn: 'root' })
|
||||
|
@ -19,7 +19,7 @@ export class UniqueAlterEgoValidator implements AsyncValidator {
|
|||
): Promise<ValidationErrors | null> | Observable<ValidationErrors | null> {
|
||||
return this.heroesService.isAlterEgoTaken(ctrl.value).pipe(
|
||||
map(isTaken => (isTaken ? { uniqueAlterEgo: true } : null)),
|
||||
catchError(() => null)
|
||||
catchError(() => of(null))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue