I have a main application with one child application. I need to show the child application when I click an anchor link which is in the main application. But it's not working.
Project Structure:
one-app
-project
--scrapper
---e2e
---src
-src
In my child app's routing module, I added the routes like
const routes: Routes = [
{ path: '', component: HomeComponent}
];
and child app's app component
<router-outlet></router-outlet>
and in child app's app module, I appended the code below with the existing code
@NgModule({})
export class ScrapperSharedModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: AppModule,
providers: []
};
}
}
So far everything is good. I guess!!
Now in the parent app's routing I added the below codes
{ path: 'scrapper',
loadChildren: '../../projects/scrapper/src/app/app.module#ScrapperSharedModule'
}
and in parent app's app module, I imported the below code in the ngmodule part
imports: [
...
ScrapperSharedModule.forRoot(),
]
Now, In one of my parent app's component, I have an anchor tag
<a routerLink="/scrapper">
When I click this link, nothing is happening. I mean the Url is changing but the browser shows the parent app not the child app. What am I doing wrong here?
from Routing through multiple projects in a single angular app
No comments:
Post a Comment