0

I am using my TestModule in main routing.module.ts which is available on the path /test

   {
      path: "test",
      loadChildren: () => import('../pages/test.module').then(m => m.TestModule),
   },

And here is test.module.ts

const routes: Routes = [
    {
        path: '',
        component: TestComponent,
    },
];
@NgModule({
    declarations: [TestComponent, Test2Component],
    imports: [
        OtherModules,
        RouterModule.forChild(routes), 
    ],
    exports: [Test2Component],
})
export class TestModule {}

Then I import TestModule to use one of the components in another module NavBarModule which is available everywhere. And as a result, my default routes are overridden, and my TestComponent is available in those routes where it should not be available. Angular v15. How can I fix this?

Oleg Om
  • 429
  • 5
  • 15

0 Answers0