From 7cefec77efd1fa17982b86fa87084b818df328a6 Mon Sep 17 00:00:00 2001 From: Torgeir Helgevold Date: Tue, 7 Jun 2016 18:10:13 -0400 Subject: [PATCH] fix(ngUpgrade): prevent digest already in progress (#9054) fix(ngUpgrade): prevent digest already in progress --- modules/@angular/upgrade/src/angular_js.ts | 1 + modules/@angular/upgrade/src/upgrade_adapter.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/@angular/upgrade/src/angular_js.ts b/modules/@angular/upgrade/src/angular_js.ts index 02d6fd6d31..99e4a3115f 100644 --- a/modules/@angular/upgrade/src/angular_js.ts +++ b/modules/@angular/upgrade/src/angular_js.ts @@ -26,6 +26,7 @@ export interface IRootScopeService { $apply(): any; $apply(exp: string): any; $apply(exp: Function): any; + $evalAsync(): any; $$childTail: IScope; $$childHead: IScope; $$nextSibling: IScope; diff --git a/modules/@angular/upgrade/src/upgrade_adapter.ts b/modules/@angular/upgrade/src/upgrade_adapter.ts index 6f93bb039a..e8566aa435 100644 --- a/modules/@angular/upgrade/src/upgrade_adapter.ts +++ b/modules/@angular/upgrade/src/upgrade_adapter.ts @@ -366,7 +366,7 @@ export class UpgradeAdapter { (injector: angular.IInjectorService, rootScope: angular.IRootScopeService) => { ng1Injector = injector; ngZone.onMicrotaskEmpty.subscribe( - {next: (_) => ngZone.runOutsideAngular(() => rootScope.$apply())}); + {next: (_) => ngZone.runOutsideAngular(() => rootScope.$evalAsync())}); UpgradeNg1ComponentAdapterBuilder.resolve(this.downgradedComponents, injector) .then(resolve, reject); }