fix(router): fix index routes

This commit is contained in:
vsavkin
2016-06-02 11:30:38 -07:00
parent 243612e36d
commit d95f0fd83d
6 changed files with 89 additions and 30 deletions

View File

@ -38,11 +38,12 @@ export function createEmptyState(rootComponent: Type): RouterState {
}
function createEmptyStateSnapshot(rootComponent: Type): RouterStateSnapshot {
const emptyUrl = [new UrlSegment("", {}, PRIMARY_OUTLET)];
const rootUrlSegment = new UrlSegment("", {}, PRIMARY_OUTLET);
const emptyUrl = [rootUrlSegment];
const emptyParams = {};
const emptyQueryParams = {};
const fragment = "";
const activated = new ActivatedRouteSnapshot(emptyUrl, emptyParams, PRIMARY_OUTLET, rootComponent, null);
const activated = new ActivatedRouteSnapshot(emptyUrl, emptyParams, PRIMARY_OUTLET, rootComponent, null, rootUrlSegment);
return new RouterStateSnapshot(new TreeNode<ActivatedRouteSnapshot>(activated, []), emptyQueryParams, fragment);
}
@ -91,12 +92,17 @@ export class ActivatedRouteSnapshot {
/** @internal **/
_routeConfig: Route;
/** @internal **/
_lastUrlSegment: UrlSegment;
constructor(public urlSegments: UrlSegment[],
public params: Params,
public outlet: string,
public component: Type | string,
routeConfig: Route) {
routeConfig: Route,
lastUrlSegment: UrlSegment) {
this._routeConfig = routeConfig;
this._lastUrlSegment = lastUrlSegment;
}
}