Why ExpressionChangedAfterItHasBeenCheckedError is throwed only with @Input()?

54 Views Asked by At

I'm trying to deeply understand ExpressionChangedAfterItHasBeenCheckedError in Angular. I read a lot of materials but still I got some doubts when and why this error is thrown

Usual explanation of that issue is :

Angular throws an ExpressionChangedAfterItHasBeenCheckedError when an expression value has been changed after change detection has completed.

Here I got some two stackblitz solution, which changes parent value before stop of change detection cycle. This change is triggered from child by emit event. In one of them I got error , in second one no..

Here there is no error https://stackblitz.com/edit/angular-12-template-bec6f1?file=src%2Fapp%2Fchild%2Fchild.component.ts

Here there is error https://stackblitz.com/edit/angular-12-template-hhbsrj?file=src%2Fapp%2Fchild%2Fchild.component.ts

I have to projects but in second of them "test" value is input value.

Why there is no error only in second case?

0

There are 0 best solutions below