1

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?

Vikas
  • 11,859
  • 7
  • 45
  • 69
ruddnisrus
  • 187
  • 5
  • https://www.youtube.com/watch?v=zKJM0I87Tt4&ab_channel=MinkoGechev – Vikas May 24 '23 at 04:52
  • https://www.youtube.com/watch?v=O47uUnJjbJc&ab_channel=Angular – Vikas May 24 '23 at 04:52
  • Does this answer your question? [Expression \_\_\_ has changed after it was checked](https://stackoverflow.com/questions/34364880/expression-has-changed-after-it-was-checked) – Vikas May 24 '23 at 04:53
  • @Vikas no... as I said, I already check a lot of materials but there are no materials which contains information between difference with Input and no Input. In my two cases there are two cases which already console log's problem – ruddnisrus May 24 '23 at 08:00
  • @MateuszKaleta Ideally that's not the case, I have seen lot of questions whose answers were one google search away. – Vikas May 24 '23 at 10:02
  • @ruddnisrus https://admin.indepth.dev/deep-dive-into-the-infamous-expressionchangedafterithasbeencheckederror-in-angular/ check this out, It has in depth explanation and if you observe carefully it answers your question too. – Vikas May 24 '23 at 10:07

0 Answers0