diff --git a/npm/ng-packs/apps/dev-app/src/app/app-routing.module.ts b/npm/ng-packs/apps/dev-app/src/app/app-routing.module.ts index f1605c4cdd..1f4d66fe5d 100644 --- a/npm/ng-packs/apps/dev-app/src/app/app-routing.module.ts +++ b/npm/ng-packs/apps/dev-app/src/app/app-routing.module.ts @@ -21,8 +21,7 @@ const routes: Routes = [ }, { path: 'setting-management', - loadChildren: () => - import('@abp/ng.setting-management').then(m => m.SettingManagementModule.forLazy()), + loadChildren: () => import('@abp/ng.setting-management').then(m => m.settingManagementRoutes), }, ]; diff --git a/npm/ng-packs/packages/setting-management/src/lib/components/setting-management.component.ts b/npm/ng-packs/packages/setting-management/src/lib/components/setting-management.component.ts index e5f3380dba..dcc9185397 100644 --- a/npm/ng-packs/packages/setting-management/src/lib/components/setting-management.component.ts +++ b/npm/ng-packs/packages/setting-management/src/lib/components/setting-management.component.ts @@ -1,12 +1,15 @@ -import { ABP } from '@abp/ng.core'; +import { ABP, CoreModule } from '@abp/ng.core'; import { SettingTabsService } from '@abp/ng.setting-management/config'; import { Component, OnDestroy, OnInit, TrackByFunction } from '@angular/core'; import { Subscription } from 'rxjs'; +import { CommonModule } from '@angular/common'; +import { ThemeSharedModule } from '@abp/ng.theme.shared'; +import { PageModule } from '@abp/ng.components/page'; @Component({ - standalone: false, selector: 'abp-setting-management', templateUrl: './setting-management.component.html', + imports: [CommonModule, CoreModule, ThemeSharedModule, PageModule], }) export class SettingManagementComponent implements OnDestroy, OnInit { private subscription = new Subscription(); diff --git a/npm/ng-packs/packages/setting-management/src/lib/setting-management.module.ts b/npm/ng-packs/packages/setting-management/src/lib/setting-management.module.ts index 5e88b588cf..a16e719bfa 100644 --- a/npm/ng-packs/packages/setting-management/src/lib/setting-management.module.ts +++ b/npm/ng-packs/packages/setting-management/src/lib/setting-management.module.ts @@ -1,14 +1,11 @@ -import { PageModule } from '@abp/ng.components/page'; -import { CoreModule, LazyModuleFactory } from '@abp/ng.core'; -import { ThemeSharedModule } from '@abp/ng.theme.shared'; +import { LazyModuleFactory } from '@abp/ng.core'; import { ModuleWithProviders, NgModule, NgModuleFactory } from '@angular/core'; -import { SettingManagementComponent } from './components/setting-management.component'; import { SettingManagementRoutingModule } from './setting-management-routing.module'; @NgModule({ - declarations: [SettingManagementComponent], - exports: [SettingManagementComponent], - imports: [SettingManagementRoutingModule, CoreModule, ThemeSharedModule, PageModule], + declarations: [], + exports: [], + imports: [SettingManagementRoutingModule], }) export class SettingManagementModule { static forChild(): ModuleWithProviders { diff --git a/npm/ng-packs/packages/setting-management/src/lib/setting-management.routes.ts b/npm/ng-packs/packages/setting-management/src/lib/setting-management.routes.ts new file mode 100644 index 0000000000..37ef197fa9 --- /dev/null +++ b/npm/ng-packs/packages/setting-management/src/lib/setting-management.routes.ts @@ -0,0 +1,33 @@ +import { Routes } from '@angular/router'; +import { + authGuard, + ReplaceableComponents, + ReplaceableRouteContainerStandaloneComponent, + RouterOutletStandaloneComponent, +} from '@abp/ng.core'; +import { SettingManagementComponent } from './components/setting-management.component'; +import { eSettingManagementComponents } from './enums/components'; +import { provideSettingManagement } from './setting-management'; + +export const settingManagementRoutes: Routes = [ + { + path: '', + component: RouterOutletStandaloneComponent, + canActivate: [authGuard], + providers: [...provideSettingManagement()], + children: [ + { + path: '', + component: ReplaceableRouteContainerStandaloneComponent, + data: { + requiredPolicy: 'AbpAccount.SettingManagement', + replaceableComponent: { + key: eSettingManagementComponents.SettingManagement, + defaultComponent: SettingManagementComponent, + } as ReplaceableComponents.RouteData, + }, + }, + ], + title: 'AbpSettingManagement::Settings', + }, +]; diff --git a/npm/ng-packs/packages/setting-management/src/lib/setting-management.ts b/npm/ng-packs/packages/setting-management/src/lib/setting-management.ts new file mode 100644 index 0000000000..bd90296fb6 --- /dev/null +++ b/npm/ng-packs/packages/setting-management/src/lib/setting-management.ts @@ -0,0 +1,3 @@ +export function provideSettingManagement() { + return []; +} diff --git a/npm/ng-packs/packages/setting-management/src/public-api.ts b/npm/ng-packs/packages/setting-management/src/public-api.ts index 24e62d4da1..673b3f281a 100644 --- a/npm/ng-packs/packages/setting-management/src/public-api.ts +++ b/npm/ng-packs/packages/setting-management/src/public-api.ts @@ -1,3 +1,4 @@ export * from './lib/setting-management.module'; export * from './lib/components/setting-management.component'; export * from './lib/enums'; +export * from './lib/setting-management.routes';