From 3f4a97b378cd31b84cced80eaa28ab45f7d32673 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Tue, 31 Dec 2019 13:45:29 +0300 Subject: [PATCH] feat(module-template): make module component replaceable #2404 --- .../src/lib/my-project-name-routing.module.ts | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/templates/module/angular/projects/my-project-name/src/lib/my-project-name-routing.module.ts b/templates/module/angular/projects/my-project-name/src/lib/my-project-name-routing.module.ts index 5ef00189aa..c1018686fe 100644 --- a/templates/module/angular/projects/my-project-name/src/lib/my-project-name-routing.module.ts +++ b/templates/module/angular/projects/my-project-name/src/lib/my-project-name-routing.module.ts @@ -1,4 +1,10 @@ -import { AuthGuard, DynamicLayoutComponent, PermissionGuard } from '@abp/ng.core'; +import { + AuthGuard, + DynamicLayoutComponent, + PermissionGuard, + ReplaceableComponents, + ReplaceableRouteContainerComponent, +} from '@abp/ng.core'; import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { MyProjectNameComponent } from './components/my-project-name.component'; @@ -8,8 +14,19 @@ const routes: Routes = [ path: '', component: DynamicLayoutComponent, canActivate: [AuthGuard, PermissionGuard], - data: { requiredPolicy: '' }, - children: [{ path: '', component: MyProjectNameComponent }], + children: [ + { + path: '', + component: ReplaceableRouteContainerComponent, + data: { + requiredPolicy: '', + replaceableComponent: { + defaultComponent: MyProjectNameComponent, + key: 'MyProjectName.MyProjectNameComponent', + } as ReplaceableComponents.RouteData, + }, + }, + ], }, ];