12 changed files with 85 additions and 15 deletions
@ -0,0 +1,12 @@ |
|||
import { ModuleWithProviders, NgModule } from '@angular/core'; |
|||
import { CATALOG_ROUTE_PROVIDERS } from './providers/route.provider'; |
|||
|
|||
@NgModule() |
|||
export class CatalogConfigModule { |
|||
static forRoot(): ModuleWithProviders<CatalogConfigModule> { |
|||
return { |
|||
ngModule: CatalogConfigModule, |
|||
providers: [CATALOG_ROUTE_PROVIDERS], |
|||
}; |
|||
} |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
export * from './policy-names'; |
|||
export * from './route-names'; |
|||
@ -0,0 +1,4 @@ |
|||
export const enum eCatalogPolicyNames { |
|||
Catalog = 'AbpCatalog.ProductManagement', |
|||
ProductManagement = 'AbpCatalog.ProductManagement', |
|||
} |
|||
@ -0,0 +1,4 @@ |
|||
export const enum eCatalogRouteNames { |
|||
Catalog = 'AbpCatalog::Menu::Catalog', |
|||
ProductManagement = 'AbpCatalog::Menu:ProductManagement', |
|||
} |
|||
@ -0,0 +1 @@ |
|||
export * from './route.provider'; |
|||
@ -0,0 +1,31 @@ |
|||
import { eLayoutType, RoutesService } from '@abp/ng.core'; |
|||
import { APP_INITIALIZER } from '@angular/core'; |
|||
import { eCatalogRouteNames } from '../enums/route-names'; |
|||
|
|||
export const CATALOG_ROUTE_PROVIDERS = [ |
|||
{ provide: APP_INITIALIZER, useFactory: configureRoutes, deps: [RoutesService], multi: true }, |
|||
]; |
|||
|
|||
export function configureRoutes(routesService: RoutesService) { |
|||
return () => { |
|||
routesService.add([ |
|||
{ |
|||
path: '/catalog', |
|||
name: eCatalogRouteNames.Catalog, |
|||
layout: eLayoutType.application, |
|||
// TODO: find icon
|
|||
iconClass: 'fa fa-users', |
|||
// TODO: add this policy
|
|||
// requiredPolicy: eCatalogPolicyNames.Catalog,
|
|||
}, |
|||
{ |
|||
path: '/catalog', |
|||
name: eCatalogRouteNames.ProductManagement, |
|||
parentName: eCatalogRouteNames.Catalog, |
|||
order: 1, |
|||
// TODO: add this policy
|
|||
// requiredPolicy: eCatalogPolicyNames.ProductManagement,
|
|||
}, |
|||
]); |
|||
}; |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
export * from './catalog-config.module'; |
|||
export * from './enums'; |
|||
export * from './providers'; |
|||
@ -0,0 +1,11 @@ |
|||
import { NgModule } from '@angular/core'; |
|||
import { RouterModule, Routes } from '@angular/router'; |
|||
import { CatalogComponent } from './catalog.component'; |
|||
|
|||
const routes: Routes = [{ path: '', component: CatalogComponent }]; |
|||
|
|||
@NgModule({ |
|||
imports: [RouterModule.forChild(routes)], |
|||
exports: [RouterModule], |
|||
}) |
|||
export class CatalogRoutingModule {} |
|||
@ -1,16 +1,10 @@ |
|||
import { NgModule } from '@angular/core'; |
|||
import { CatalogRoutingModule } from './catalog-routing.module'; |
|||
import { CatalogComponent } from './catalog.component'; |
|||
|
|||
|
|||
|
|||
@NgModule({ |
|||
declarations: [ |
|||
CatalogComponent |
|||
], |
|||
imports: [ |
|||
], |
|||
exports: [ |
|||
CatalogComponent |
|||
] |
|||
declarations: [CatalogComponent], |
|||
imports: [CatalogRoutingModule], |
|||
exports: [CatalogComponent], |
|||
}) |
|||
export class CatalogModule { } |
|||
export class CatalogModule {} |
|||
|
|||
Loading…
Reference in new issue