-
Notifications
You must be signed in to change notification settings - Fork 0
Importing
To use the library you need to import it's module.
You have to 2 options of doing this based on desired behavior:
- Use Angular's
Router
configuration for menu generation - Manually provide all router configuration for menu generation
Import as:
DynamicMenuModule.forRouter(extras?: DynamicMenuExtras)
Types: DynamicMenuExtras
extras.listenForConfigChanges = true
by default
This will use Router
from Angular to get router configuration.
It will work just fine with one caveat - configuration from lazy loaded modules will not be available
until it's module is loaded by Angular, which means that NOT whole menu subtree will be rendered.
However once the module is loaded - menu will be re-built and re-rendered with new information.
Import as:
DynamicMenuModule.withRoutes(routes: RoutesWithMenu, extras?: DynamicMenuExtras)
Types: RoutesWithMenu
, DynamicMenuExtras
This will use provided routes
for menu.
It is useful if you can resolve your routing configuration Ahead-of-Time
so your lazy-loaded modules configuration is known at the beginning.
You can use ng-router-resolver to get your routing configuration as JSON file.