Open Closed

Replace component template with ABP suite #4218


User avatar
0
guven.uysall created
  • ABP Framework version: v5.3.3
  • UI type: Angular

Hi support, about three months ago I asked the following question. https://support.abp.io/QA/Questions/3667/Angular-Replace-Component

The answer was given below. https://support.abp.io/QA/Questions/3667/Angular-Replace-Component#answer-4cf80b67-c79f-0795-0aea-3a06349df410

{
    path: '',
    component: RouterOutletComponent,
    canActivate: [AuthGuard, PermissionGuard],
    children: [
      {
        path: '',
        component: ReplaceableRouteContainerComponent,
        data: {
          replaceableComponent: {
            key: 'YOUR_COMPONENT_KEY',
            defaultComponent: BookComponent,
          } as ReplaceableComponents.RouteData<BookComponent>,
        },
      },
    ],
  },

how can i set it as a template in ABP suite. I can edit the appcomponent side myself, but how can I replace the provider of the components with the template in suite.

Thanks your answer @muhammedaltug :)

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

7 Answer(s)
  • User Avatar
    0
    guven.uysall created

    Hi support,

    Do you have an opinion on the subject?

    Thanks.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    muhammedaltug created

    Hello,

    Do you want to change BookComponent's providers(Example: BookService)?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    guven.uysall created

    Hi @muhammed,

    Actually, I want to update the routing module suite template according to my own request.

    If I make the code below without using tepmlate, it will disappear the next time I generate code with suite.

    {
        path: '',
        component: RouterOutletComponent,
        canActivate: [AuthGuard, PermissionGuard],
        children: [
          {
            path: '',
            component: ReplaceableRouteContainerComponent,
            data: {
              replaceableComponent: {
                key: 'YOUR_COMPONENT_KEY',
                defaultComponent: BookComponent,
              } as ReplaceableComponents.RouteData,
            },
          },
        ],
      },
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    muhammedaltug created

    Hello,

    You can edit the template on ABP Suite. Click templates on the navbar and edit Frontend.Angular.__name@kebab__-routing.module.ts.template to edit the routing module. For your case, you can replace it with the content below

    import { AuthGuard, PermissionGuard, RouterOutletComponent, ReplaceableComponents } from '@abp/ng.core';
    import { NgModule } from '@angular/core';
    import { RouterModule, Routes } from '@angular/router';
    import { <%= name %>Component } from './components/<%= kebab(name) %>.component';
    
    const routes: Routes = [
    {
        path: '',
        component: RouterOutletComponent,
        canActivate: [AuthGuard, PermissionGuard],
        children: [
          {
            path: '',
            component: <%= name %>Component,
            data: {
              replaceableComponent: {
                key: '<%= name %>ComponentKey',
                defaultComponent: <%= name %>Component,
              } as ReplaceableComponents.RouteData,
            },
          },
        ],
      }
    ];
    
    @NgModule({
      imports: [RouterModule.forChild(routes)],
      exports: [RouterModule],
    })
    export class <%= name %>RoutingModule {}
    
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    guven.uysall created

    Hi @muhammed, I can't see angular template on suite for microservice projects

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    1
    muhammedaltug created

    Hello

    We created an internal issue about this problem.

    As a workaround, you can replace angular/.suite/schematics/commands/entity/files/__modulePath__/_name@kebab__-routing.module.ts.template file manually.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    guven.uysall created

    Thanks

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 28, 2026, 11:44
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.