Skip to content

ExpressionChangedAfterItHasBeenCheckedError when *ngIf and asyncValidator use the same observable #47517

Description

@JimmyRowland

Which @angular/* package(s) are the source of the bug?

zone.js

Is this a regression?

No

Description

<ng-container *ngIf="observable|async">
    <input formControlName="name">
  </ng-container>

When nameFormControl has an asyncValidator that depends on observable
The console prints out the following error:
ERROR
Error: NG0100: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'true'. Current value: 'false'. Find more at https://angular.io/errors/NG0100

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/angular-ivy-z9hej4?file=src/app/app.component.html

Please provide the exception or error you saw

ERROR
Error: NG0100: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'true'. Current value: 'false'. Find more at https://angular.io/errors/NG0100

Please provide the environment you discovered this bug in (run ng version)

See stackblitz
https://stackblitz.com/edit/angular-ivy-z9hej4?file=src/app/app.component.html

Anything else?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions