fix(router): add relativeLinkResolution to recognize operator (#26990)

Close #26983

PR Close #26990
This commit is contained in:
Sarun Intaralawan
2018-11-08 04:18:08 +07:00
committed by Andrew Kushnir
parent f0c4f31771
commit a752971bca
3 changed files with 91 additions and 5 deletions

View File

@ -17,13 +17,13 @@ import {UrlTree} from '../url_tree';
export function recognize(
rootComponentType: Type<any>| null, config: Route[], serializer: (url: UrlTree) => string,
paramsInheritanceStrategy: 'emptyOnly' |
'always'): MonoTypeOperatorFunction<NavigationTransition> {
paramsInheritanceStrategy: 'emptyOnly' | 'always', relativeLinkResolution: 'legacy' |
'corrected'): MonoTypeOperatorFunction<NavigationTransition> {
return function(source: Observable<NavigationTransition>) {
return source.pipe(mergeMap(
t => recognizeFn(
rootComponentType, config, t.urlAfterRedirects, serializer(t.urlAfterRedirects),
paramsInheritanceStrategy)
paramsInheritanceStrategy, relativeLinkResolution)
.pipe(map(targetSnapshot => ({...t, targetSnapshot})))));
};
}
}

View File

@ -414,7 +414,7 @@ export class Router {
// Recognize
recognize(
this.rootComponentType, this.config, (url) => this.serializeUrl(url),
this.paramsInheritanceStrategy),
this.paramsInheritanceStrategy, this.relativeLinkResolution),
// Fire RoutesRecognized
tap(t => {