From 655b0e7e4f02d2eafce5387f5fd8ca5454ff3e86 Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Thu, 15 Oct 2020 10:24:56 +0300 Subject: [PATCH] fix: modify findRoute termination condition --- .../packages/core/src/lib/utils/route-utils.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/npm/ng-packs/packages/core/src/lib/utils/route-utils.ts b/npm/ng-packs/packages/core/src/lib/utils/route-utils.ts index 388e76cbf8..8c9553fac2 100644 --- a/npm/ng-packs/packages/core/src/lib/utils/route-utils.ts +++ b/npm/ng-packs/packages/core/src/lib/utils/route-utils.ts @@ -1,22 +1,16 @@ +import { NgZone } from '@angular/core'; import { PRIMARY_OUTLET, Router, UrlSegmentGroup } from '@angular/router'; import { ABP } from '../models/common'; import { RoutesService } from '../services/routes.service'; -import { TreeNode } from './tree-utils'; import { noop } from './common-utils'; -import { NgZone } from '@angular/core'; +import { TreeNode } from './tree-utils'; export function findRoute(routes: RoutesService, path: string): TreeNode { const node = routes.find(route => route.path === path); return node || path === '/' ? node - : findRoute( - routes, - path - .split('/') - .slice(0, -1) - .join('/'), - ); + : findRoute(routes, path.split('/').slice(0, -1).join('/') || '/'); } export function getRoutePath(router: Router, url = router.url) {