Last active
July 2, 2020 03:37
-
-
Save yokoishioka/d6772baccdbec7cc5031f1bba4718572 to your computer and use it in GitHub Desktop.
Angular resolver that creates a navigation menu based on the module's routes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NgModule } from '@angular/core'; | |
import { Routes, RouterModule } from '@angular/router'; | |
import { MetaTagsResolverRouteDataService } from 'projects/meta-tags/src/public-api'; | |
import { ResolveMenuService } from 'projects/menus/src/public-api'; | |
import { DemosComponent } from './demos.component'; | |
import { DemoSelectMenusComponent } from './demo-select-menus/demo-select-menus.component'; | |
export const routes: Routes = [ | |
{ | |
path: '', | |
component: DemosComponent, | |
data: { | |
title: 'Demos' | |
}, | |
resolve: { | |
displayTitle: MetaTagsResolverRouteDataService, | |
menu: ResolveMenuService | |
}, | |
children: [ | |
{ | |
path: 'select-menus', | |
component: DemoSelectMenusComponent, | |
data: { | |
title: 'Select Menus', | |
description: "Cloud engineering demo of customizable select menus", | |
menu: { | |
icon: 'dropdown', | |
label: 'Select Menus', | |
show: true, | |
activeSelfOnly: true, | |
}, | |
}, | |
resolve: { | |
ActivatedRoute: MetaTagsResolverRouteDataService | |
} | |
}, | |
] | |
} | |
]; | |
@NgModule({ | |
imports: [RouterModule.forChild(routes)], | |
providers: [ | |
], | |
exports: [RouterModule], | |
}) | |
export class DemosRoutingModule { } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment