Angular : How to use app.tick() ? Can anyone give me an example of ApplicationRef.tick()?

Ask a question+

When we talk about Change Detection mechanism in Angular 2, everyone suggests using NgZone or ChangeDetectorRef.

Is there any working example of application.tick()/ApplicationRef.tick() which also does the same thing as ChangeDetectorRef/NgZone.

Second question: API says, in DEV MODE, ApplicationRef.tick() runs the change detection more than once.

Is there a way to run it only once. Because the moment I use this method, I get an error saying

ApplicationRef.tick() is called recursively

Similar example of the problem I face using tick() is here in this Github Link

I have gone through Triggering Change Detection Manually Question.

Any info in this appreciated. Thanks.

add comment

0 Answer

Your Answer