diff --git a/aio/content/examples/form-validation/src/app/shared/alter-ego.directive.ts b/aio/content/examples/form-validation/src/app/shared/alter-ego.directive.ts index f8230e3195..bf08aa6bd3 100644 --- a/aio/content/examples/form-validation/src/app/shared/alter-ego.directive.ts +++ b/aio/content/examples/form-validation/src/app/shared/alter-ego.directive.ts @@ -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 | Observable { return this.heroesService.isAlterEgoTaken(ctrl.value).pipe( map(isTaken => (isTaken ? { uniqueAlterEgo: true } : null)), - catchError(() => null) + catchError(() => of(null)) ); } }