I have a simple scenario, but just can\'t get it working!
In my view I display some text in a box with limited height.
The text is being fetched from the server,
Causing change detector to run after ngAfterContentChecked solved the problem for me
example as below:
import { ChangeDetectorRef,AfterContentChecked} from '@angular/core'
export class example implements OnInit, AfterContentChecked {
ngAfterContentChecked() : void {
this.changeDetector.detectChanges();
}
}
Although, as I read some of the articles, this issue gets solved in production mode without any required fix.
Below is the possible reason for such issue:
It enforces a uni-directional data flow: when the data on our controller classes gets updated, change detection runs and updates the view.
But that updating of the view does not itself trigger further changes which on their turn trigger further updates to the view
https://blog.angular-university.io/how-does-angular-2-change-detection-really-work/