UNPKG

@c8y/apps

Version:

Cumulocity IoT applications

78 lines (72 loc) 1.71 kB
import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { CoreModule, HOOK_NAVIGATOR_NODES, HOOK_ROUTE, NavigatorNode, ViewContext } from '@c8y/ngx-components'; import { ServicesDeviceTabModule } from '@c8y/ngx-components/services'; import { ServiceDashboardComponent } from '../dashboard/service-dashboard.component'; import { ListVirtualScrollComponent } from './list-virtual-scroll.component'; import { ListComponent } from './list.component'; /** * Angular Routes. * Within this array at least path (url) and components are linked. */ const routes: Routes = [ { path: 'list', component: ListComponent }, { path: 'list-virtual-scroll', component: ListVirtualScrollComponent } ]; const root = new NavigatorNode({ label: 'Lists', icon: 'c8y-device', priority: 97 }); root.add( new NavigatorNode({ label: 'basic', path: '/list', routerLinkExact: false }) ); root.add( new NavigatorNode({ label: 'virtual scroll', path: '/list-virtual-scroll', routerLinkExact: false }) ); @NgModule({ declarations: [ListComponent, ListVirtualScrollComponent], imports: [RouterModule.forChild(routes), CoreModule, ServicesDeviceTabModule], providers: [ { provide: HOOK_NAVIGATOR_NODES, useValue: { get: () => root }, multi: true }, { provide: HOOK_ROUTE, useValue: [ { path: 'info', context: ViewContext.Service, component: ServiceDashboardComponent, label: 'Service info', priority: 900, icon: 'rocket' } ], multi: true } ] }) export class ListModule {}