Reputation: 163
I assume 'ApplicationRef_.prototype.tick()' in @angular/core is needed to update the DOM properly in angular 2 RC4, (and properly earlier version as well)
In an angular 2 hybrid setup, created from 5 min quickstart example (https://angular.io/guide/quickstart), this method is called, but it seems it is only called finite amount of times initially.
I am having an issue with change detection in a hybrid setup (ng1 & ng2 working together using upgradeAdapter) and only in certain servers. This leads me to dig deep into change detection.
My question is: what could cause 'ApplicationRef_.prototype.tick()' to be called periodically? It seems that in the case where my component works, this method is called periodically, NOT finite amount of time like the 5 min quickstart. And maybe I will need to force that to ensure it works stably.
Sorry there is no plunker as I haven't been able to generated a simplified version of my current situation
Thanks!
Upvotes: 0
Views: 449
Reputation: 163
It turns out there was bug with ng2 upgrade adapter RC.4 -> 2.0.1 final.
In upgrade_adapter.ts
:
ngZone.onMicrotaskEmpty.subscribe({
next: (_: any) => ngZone.runOutsideAngular(() => rootScope.$evalAsync())
});
If that is changed to:
ngZone.onMicrotaskEmpty.subscribe({
next: (_: any) => ngZone.run(() => rootScope.$evalAsync())
});
Change detection seems to work.
One drawback is: this will re-introduce the infinite $rootScope.$digest
(https://github.com/angular/angular/issues/6385)
Upvotes: -1