feat(router): guard returning UrlTree cancels current navigation and redirects (#26521)

Fixes #24618
FW-153 #resolve

PR Close #26521
This commit is contained in:
Jason Aden
2018-10-17 09:30:45 -07:00
committed by Matias Niemelä
parent 081f95c812
commit 4e9f2e5895
8 changed files with 116 additions and 23 deletions

View File

@ -672,10 +672,11 @@ function checkGuards(
guards: getAllRouteGuards(future, curr, new ChildrenOutletContexts())
} as Partial<NavigationTransition>)
.pipe(checkGuardsOperator(injector))
.subscribe(
t => {
if (t.guardsResult === null) throw new Error('Guard result expected');
return check(t.guardsResult);
},
(e) => { throw e; });
.subscribe({
next(t) {
if (t.guardsResult === null) throw new Error('Guard result expected');
return check(t.guardsResult);
},
error(e) { throw e; }
});
}