angular component not updating

Author
Hao Wang Author
|
3 days ago Asked
|
10 Views
|
2 Replies
0

i'm totally stuck with my angular app. my main angular component just won't update its view after an async call, even with ChangeDetectionStrategy.OnPush. i've been pulling my hair out for hours trying to figure out this change detection issue, any ideas?

thanks in advance!

2 Answers

0
MD Alamgir Hossain Nahid
Answered 23 hours ago
Hello Hao Wang,
i'm totally stuck with my angular app. my main angular component just won't update its view after an async call...
Ah, the joys of Angular change detection with OnPush, right? After your async call completes, you'll need to explicitly trigger a check using either `this.cdr.detectChanges()` or `this.cdr.markForCheck()` (after injecting `ChangeDetectorRef` into your component) to ensure the UI refreshes. Hope this helps your conversions!
0
Hao Wang
Answered 22 hours ago

Yeah, that's exactly what I ended up doing after some more fiddling around. It's always something with Angular's change detection, ngl. Glad it's sorted tho, time to sign off for the day.

Your Answer

You must Log In to post an answer and earn reputation.