I am wondering what's the advantage or disadvantage of using one over other:
constructor(private app:ApplicationRef, private ref:ChangeDetectorRef) {
this.ref.markForCheck();
// OR
this.ref.detectChanges()
// will do same thing?
...
vs
zone.run
(() => doSomething())
...
vs
app.tick();
they all essentially will mark the component for checking and updates / redraw the UI.
I know app.tick()
will do it for the entire app, but in my tests it didn't actually force the UI to update.
zone.run
and markforCheck
both force the UI to update on the next zone cycle check, so why use one over the other?