fix(router): handle when both primary and secondary are empty-path and primary has a child

This commit is contained in:
vsavkin
2016-07-22 18:32:26 -07:00
parent 06e4ca4bb3
commit 2b63330a36
6 changed files with 38 additions and 6 deletions

View File

@ -342,7 +342,7 @@ function createChildrenForEmptyPaths(
const res: {[name: string]: UrlSegment} = {};
res[PRIMARY_OUTLET] = primarySegment;
for (let r of routes) {
if (r.path === '') {
if (r.path === '' && getOutlet(r) !== PRIMARY_OUTLET) {
res[getOutlet(r)] = new UrlSegment([], {});
}
}

View File

@ -60,7 +60,7 @@ import {UrlTree} from '../url_tree';
component</a>
* ```
*
* The router link directive always treats it the provided input as a delta to the current url.
* The router link directive always treats the provided input as a delta to the current url.
*
* For instance, if the current url is `/user/(box//aux:team)`.
*

View File

@ -128,8 +128,6 @@ function processPathsWithParamsAgainstRoute(
const childConfig = getChildConfig(route);
const {segment, slicedPath} = split(rawSegment, consumedPaths, rawSlicedPath, childConfig);
// console.log("raw", rawSegment)
// console.log(segment.toString(), childConfig)
const snapshot = new ActivatedRouteSnapshot(
consumedPaths, Object.freeze(merge(inherited.allParams, parameters)),
@ -292,7 +290,7 @@ function createChildrenForEmptyPaths(
primarySegment._pathIndexShift = consumedPaths.length;
for (let r of routes) {
if (r.path === '') {
if (r.path === '' && getOutlet(r) !== PRIMARY_OUTLET) {
const s = new UrlSegment([], {});
s._sourceSegment = segment;
s._pathIndexShift = consumedPaths.length;

View File

@ -289,7 +289,7 @@ export class Router {
* router.navigate(['team', 33, 'team', '11], {relativeTo: route});
* ```
*
* In opposite to `navigateByUrl`, `navigate` always takes a detla
* In opposite to `navigateByUrl`, `navigate` always takes a delta
* that is applied to the current URL.
*/
navigate(commands: any[], extras: NavigationExtras = {}): Promise<boolean> {