From d1c989b8a512aaae5e6e1002c58c3a37d6c27153 Mon Sep 17 00:00:00 2001 From: Torgeir Helgevold Date: Mon, 6 Jun 2016 16:34:27 -0400 Subject: [PATCH] fix(ngUpgrade): prevent digest already in progress (#9046) --- 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..eeb3782bdd 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; + $applyAsync(): 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..522574c6d4 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.$applyAsync())}); UpgradeNg1ComponentAdapterBuilder.resolve(this.downgradedComponents, injector) .then(resolve, reject); }