Revert "fix(router): do not finish bootstrap until all the routes are resolved (#14608)"

This reverts commit 2a191cae2d.
This commit is contained in:
Victor Berchet
2017-02-20 19:48:23 -08:00
parent 2a191cae2d
commit 670f2eca00
12 changed files with 154 additions and 304 deletions

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {LOCATION_INITIALIZED, PlatformLocation} from '@angular/common';
import {PlatformLocation} from '@angular/common';
import {APP_INITIALIZER, InjectionToken, NgZone} from '@angular/core';
import {WebWorkerPlatformLocation} from './platform_location';
@ -25,18 +25,9 @@ export const WORKER_APP_LOCATION_PROVIDERS = [
multi: true,
deps: [PlatformLocation, NgZone],
},
{
provide: LOCATION_INITIALIZED,
useFactory: locationInitialized,
deps: [PlatformLocation],
},
];
export function locationInitialized(platformLocation: WebWorkerPlatformLocation) {
return platformLocation.initialized;
}
export function appInitFnFactory(platformLocation: WebWorkerPlatformLocation, zone: NgZone): () =>
function appInitFnFactory(platformLocation: WebWorkerPlatformLocation, zone: NgZone): () =>
Promise<boolean> {
return () => zone.runGuarded(() => platformLocation.init());
}

View File

@ -22,8 +22,6 @@ export class WebWorkerPlatformLocation extends PlatformLocation {
private _hashChangeListeners: Array<Function> = [];
private _location: LocationType = null;
private _channelSource: EventEmitter<Object>;
public initialized: Promise<any>;
private initializedResolve: () => void;
constructor(
brokerFactory: ClientMessageBrokerFactory, bus: MessageBus, private _serializer: Serializer) {
@ -50,7 +48,6 @@ export class WebWorkerPlatformLocation extends PlatformLocation {
}
}
});
this.initialized = new Promise(res => this.initializedResolve = res);
}
/** @internal **/
@ -61,7 +58,6 @@ export class WebWorkerPlatformLocation extends PlatformLocation {
.then(
(val: LocationType) => {
this._location = val;
this.initializedResolve();
return true;
},
err => { throw new Error(err); });