I have two lists of components that use data provided by two different services:
- the first list contains some components with random heights (I don't know their heights until they are rendered)
- the components in the second list must have their heights calculated based on the heights of the ones in the first list.
Both lists are generated by the same component using two *ngFor loops, and the services data is changed from another child component.
The problem is that when the model data changes, both ngFor loops try to update the template, but the second one fails because it is dependent upon the first ngFor which is not yet ready.
I did try to use ChangeDetectorRef.detectChanges() or to listen for the changes emitted by the QueryList containing the first list's components, but I'm still getting ExpressionChangedAfterItHasBeenCheckedError.
The real scenario is a bit more complicated, but here's a simplified version of what the code looks like:
https://embed.plnkr.co/sr9k0wLQtyWSATiZuqaK/
Thanks in advance, this is my first question on stackoverflow :)
ExpressionChangedAfterItHasBeenCheckedError
error – Max Koretskyi