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,
For some reason, @Tiep Phan's answer didn't work for me to force change detection, but using setTimeout (which also forces change detection) did.
I also only had to add it to the offending line, and it worked fine with the code I already had in ngOnInit instead of having to add ngAfterViewInit.
Example:
ngOnInit() {
setTimeout(() => this.loadingService.loading = true);
asyncFunctionCall().then(res => {
this.loadingService.loading = false;
})
}
More details here: https://github.com/angular/angular/issues/6005