fix(Router): do not kill event-emitter on navigation failure

Closes #7692
Closes #7532

Closes #7692
This commit is contained in:
Peter Bacon Darwin
2016-03-21 15:02:16 +00:00
committed by Misko Hevery
parent ce013a3dd9
commit cbeeff2bd6
2 changed files with 26 additions and 5 deletions

View File

@ -276,7 +276,7 @@ export class Router {
if (result) {
return this.commit(instruction, _skipLocationChange)
.then((_) => {
this._emitNavigationFinish(instruction.toRootUrl());
this._emitNavigationFinish(instruction.component);
return true;
});
}
@ -284,9 +284,13 @@ export class Router {
});
}
private _emitNavigationFinish(url): void { ObservableWrapper.callEmit(this._subject, url); }
private _emitNavigationFinish(instruction: ComponentInstruction): void {
ObservableWrapper.callEmit(this._subject, {status: 'success', instruction});
}
/** @internal */
_emitNavigationFail(url): void { ObservableWrapper.callError(this._subject, url); }
_emitNavigationFail(url: string): void {
ObservableWrapper.callEmit(this._subject, {status: 'fail', url});
}
private _afterPromiseFinishNavigating(promise: Promise<any>): Promise<any> {
return PromiseWrapper.catchError(promise.then((_) => this._finishNavigating()), (err) => {