chore(tslint): update tslint to 4.x (#13603)
This commit is contained in:
@ -159,39 +159,37 @@ export type Inherited = {
|
||||
params: Params,
|
||||
data: Data,
|
||||
resolve: Data,
|
||||
}
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
export function
|
||||
inheritedParamsDataResolve(route: ActivatedRouteSnapshot):
|
||||
Inherited {
|
||||
const pathToRoot = route.pathFromRoot;
|
||||
export function inheritedParamsDataResolve(route: ActivatedRouteSnapshot): Inherited {
|
||||
const pathToRoot = route.pathFromRoot;
|
||||
|
||||
let inhertingStartingFrom = pathToRoot.length - 1;
|
||||
let inhertingStartingFrom = pathToRoot.length - 1;
|
||||
|
||||
while (inhertingStartingFrom >= 1) {
|
||||
const current = pathToRoot[inhertingStartingFrom];
|
||||
const parent = pathToRoot[inhertingStartingFrom - 1];
|
||||
// current route is an empty path => inherits its parent's params and data
|
||||
if (current.routeConfig && current.routeConfig.path === '') {
|
||||
inhertingStartingFrom--;
|
||||
while (inhertingStartingFrom >= 1) {
|
||||
const current = pathToRoot[inhertingStartingFrom];
|
||||
const parent = pathToRoot[inhertingStartingFrom - 1];
|
||||
// current route is an empty path => inherits its parent's params and data
|
||||
if (current.routeConfig && current.routeConfig.path === '') {
|
||||
inhertingStartingFrom--;
|
||||
|
||||
// parent is componentless => current route should inherit its params and data
|
||||
} else if (!parent.component) {
|
||||
inhertingStartingFrom--;
|
||||
// parent is componentless => current route should inherit its params and data
|
||||
} else if (!parent.component) {
|
||||
inhertingStartingFrom--;
|
||||
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return pathToRoot.slice(inhertingStartingFrom).reduce((res, curr) => {
|
||||
const params = merge(res.params, curr.params);
|
||||
const data = merge(res.data, curr.data);
|
||||
const resolve = merge(res.resolve, curr._resolvedData);
|
||||
return {params, data, resolve};
|
||||
}, <any>{params: {}, data: {}, resolve: {}});
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return pathToRoot.slice(inhertingStartingFrom).reduce((res, curr) => {
|
||||
const params = merge(res.params, curr.params);
|
||||
const data = merge(res.data, curr.data);
|
||||
const resolve = merge(res.resolve, curr._resolvedData);
|
||||
return {params, data, resolve};
|
||||
}, <any>{params: {}, data: {}, resolve: {}});
|
||||
}
|
||||
|
||||
/**
|
||||
* @whatItDoes Contains the information about a route associated with a component loaded in an
|
||||
|
@ -8,6 +8,6 @@
|
||||
|
||||
import {__router_private__ as _} from '@angular/router';
|
||||
|
||||
export var ROUTER_PROVIDERS: typeof _.ROUTER_PROVIDERS = _.ROUTER_PROVIDERS;
|
||||
export var ROUTES: typeof _.ROUTES = _.ROUTES;
|
||||
export var flatten: typeof _.flatten = _.flatten;
|
||||
export const ROUTER_PROVIDERS: typeof _.ROUTER_PROVIDERS = _.ROUTER_PROVIDERS;
|
||||
export const ROUTES: typeof _.ROUTES = _.ROUTES;
|
||||
export const flatten: typeof _.flatten = _.flatten;
|
||||
|
Reference in New Issue
Block a user