Can someone tell how can I separately define routes for multiple root components in an Angular6 + angular-cli project?
Currently, I have two root components AppComponent and LoginComponent and I am doing this to load these:
index.html
<body>
<app-root></app-root>
<app-login></app-login>
</body>
app.module.ts
@NgModule({
...
bootstrap: [AppComponent, LoginComponent]
})
I have two queries:
- How can I define routes for the second root component
- How can I optionally load any root component depending on the routes?
Example: If I go to /login or /login/conf1 only LoginComponent should be loaded. For other routes AppComponent
Surprisingly, there are no tutorials about multiple root component on the web or at least I couldn't find one.
My use case for two components: Link