From 45c8d0fc84d436f20a8c1cf6e7812ccb5583e44a Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Mon, 4 Nov 2019 14:48:23 +0300 Subject: [PATCH] refactor(core): set routes order --- npm/ng-packs/packages/core/src/lib/utils/route-utils.ts | 6 ++++++ 1 file changed, 6 insertions(+) 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 05b7185d82f..8bbbee60ec2 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 @@ -51,6 +51,12 @@ export function setChildRoute(routes: ABP.FullRoute[], parentNameArr: ABP.FullRo export function sortRoutes(routes: ABP.FullRoute[] = []): ABP.FullRoute[] { if (!routes.length) return []; return routes + .map((route, index) => { + return { + ...route, + order: typeof route.order === 'undefined' ? index + 1 : route.order, + }; + }) .sort((a, b) => a.order - b.order) .map(route => { if (route.children && route.children.length) {