Skip to content

Commit

Permalink
fix(upgrade): fix infinite $rootScope.$digest()
Browse files Browse the repository at this point in the history
Fixes #6385
Closes #6386
  • Loading branch information
andreialecu authored and IgorMinar committed Feb 9, 2016
1 parent e7ad03c commit 7e0f02f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/angular2/src/upgrade/upgrade_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ export class UpgradeAdapter {
(injector: angular.IInjectorService, rootScope: angular.IRootScopeService) => {
ng1Injector = injector;
ObservableWrapper.subscribe(ngZone.onTurnDone,
(_) => { ngZone.run(() => rootScope.$apply()); });
(_) => ngZone.runOutsideAngular(() => rootScope.$apply()));
ng1compilePromise =
UpgradeNg1ComponentAdapterBuilder.resolve(this.downgradedComponents, injector);
}
Expand Down

2 comments on commit 7e0f02f

@Zizzamia
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the line 342 rootScope.$apply() force a refresh of the app any time an event happen, and in case of keydown, keypress, etc.... cause a huge slow down of the performance, making the app completely not useful.

My temp solution was to wrap the Wrapper with a Debounce.

Is it a way we can just run $scope.$digest, instead a full $apply? Or any better idea that does not force a $apply.

Thanks

@kvantetore
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an issue with this fix: running rootScope.$apply outside ngZone makes the ng1 app leave ngZone if a watch is triggered from a setTimeout (#7252)

Please sign in to comment.