From c814dfbfa5cef417f478ecfd77a59acbe8682980 Mon Sep 17 00:00:00 2001 From: Yegor Jbanov Date: Mon, 2 Nov 2015 14:42:32 -0800 Subject: [PATCH] fix: remove internal usages of deprecated overrideOnTurnDone Closes #5079 --- modules/angular2/src/core/application_ref.ts | 10 ++++++++-- modules/angular2/src/upgrade/upgrade_adapter.ts | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/angular2/src/core/application_ref.ts b/modules/angular2/src/core/application_ref.ts index 26812c15b2..cdf5e3f84e 100644 --- a/modules/angular2/src/core/application_ref.ts +++ b/modules/angular2/src/core/application_ref.ts @@ -6,7 +6,12 @@ import { APP_COMPONENT, APP_ID_RANDOM_PROVIDER } from './application_tokens'; -import {Promise, PromiseWrapper, PromiseCompleter} from 'angular2/src/core/facade/async'; +import { + Promise, + PromiseWrapper, + PromiseCompleter, + ObservableWrapper +} from 'angular2/src/core/facade/async'; import {ListWrapper} from 'angular2/src/core/facade/collection'; import {Reflector, reflector} from 'angular2/src/core/reflection/reflection'; import {TestabilityRegistry, Testability} from 'angular2/src/core/testability/testability'; @@ -369,7 +374,8 @@ export class ApplicationRef_ extends ApplicationRef { constructor(private _platform: PlatformRef_, private _zone: NgZone, private _injector: Injector) { super(); if (isPresent(this._zone)) { - this._zone.overrideOnTurnDone(() => this.tick()); + ObservableWrapper.subscribe(this._zone.onTurnDone, + (_) => { this._zone.run(() => { this.tick(); }); }); } this._enforceNoNewChanges = assertionsEnabled(); } diff --git a/modules/angular2/src/upgrade/upgrade_adapter.ts b/modules/angular2/src/upgrade/upgrade_adapter.ts index 0655e9f97e..0d704da133 100644 --- a/modules/angular2/src/upgrade/upgrade_adapter.ts +++ b/modules/angular2/src/upgrade/upgrade_adapter.ts @@ -16,6 +16,7 @@ import { import {applicationDomProviders} from 'angular2/src/core/application_common'; import {applicationCommonProviders} from 'angular2/src/core/application_ref'; import {compilerProviders} from 'angular2/src/core/compiler/compiler'; +import {ObservableWrapper} from 'angular2/src/core/facade/async'; import {getComponentInfo, ComponentInfo} from './metadata'; import {onError, controllerKey} from './util'; @@ -342,7 +343,8 @@ export class UpgradeAdapter { '$rootScope', (injector: angular.IInjectorService, rootScope: angular.IRootScopeService) => { ng1Injector = injector; - ngZone.overrideOnTurnDone(() => rootScope.$apply()); + ObservableWrapper.subscribe(ngZone.onTurnDone, + (_) => { ngZone.run(() => rootScope.$apply()); }); ng1compilePromise = UpgradeNg1ComponentAdapterBuilder.resolve(this.downgradedComponents, injector); }