Sorting Navigation Elements

This documentation describes how the navigation elements are sorted and how to change this default behaviour.

  • When you want to add the Navigation Element you can use the RoutesService. For more details, see the document.
  • However, in this documentation, we will talk more about how to sort the navigation elements.

Order Property

  • Normally, you are able to sort your routes with this property. But you can customize our default sorting algorithm.

Default Sorting algorithm

  • To see our default sorting algorithm click here. What does this function do?
    • if the order property is defined, then it will be sorted by the order value.
    • if both of the navigation elements have the same order value then it will be sorted by the name.
    • If the order property is not defined, it will be the last element and the unordered navs will be sorted by name.

How to Customize

in app.module.ts

import { SORT_COMPARE_FUNC } from "@abp/ng.core";

@NgModule({
  providers: [
    ...{
      provide: SORT_COMPARE_FUNC,
      useFactory: yourCompareFuncFactory,
    },
  ],
  // imports, declarations, and bootstrap
})
export class AppModule {}
TypeScript

Contributors


Last updated: October 10, 2024 Edit this page on GitHub

Was this page helpful?

Please make a selection.

To help us improve, please share your reason for the negative feedback in the field below.

Please enter a note.

Thank you for your valuable feedback!

Please note that although we cannot respond to feedback, our team will use your comments to improve the experience.

Community Talks

Deep Dive #1: Identity&Account Modules

17 Apr, 17:00
Online
Watch the Event
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book