Skip to content

Commit

Permalink
refactor(core): set routes order
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmet-erim committed Nov 4, 2019
1 parent 8578eeb commit 45c8d0f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions npm/ng-packs/packages/core/src/lib/utils/route-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 45c8d0f

Please sign in to comment.