Revert "refactor(router): cleanup to navigation stream for readability" and associated changes (#26060)

PR Close #26060
This commit is contained in:
Kara Erickson
2018-09-21 09:03:21 -07:00
parent d5f47d6b71
commit e7ade38731
9 changed files with 464 additions and 735 deletions

View File

@ -1,24 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {MonoTypeOperatorFunction, Observable, from, of } from 'rxjs';
import {map, mergeMap} from 'rxjs/operators';
import {NavigationTransition} from '../router';
export function checkGuards(): MonoTypeOperatorFunction<NavigationTransition> {
return function(source: Observable<NavigationTransition>) {
return source.pipe(mergeMap(t => {
if (!t.preActivation) {
throw new Error('PreActivation required to check guards');
}
return t.preActivation.checkGuards().pipe(map(guardsResult => ({...t, guardsResult})));
}));
};
}