Currently I'm using this construction to get my router-outlet working as the main app:
@Component({
selector: 'my-dummy-app',
template: '<router-outlet></router-outlet>'
})
export class MyDummyApp {
}
Is it possible to cut out the dummy app? I've not had any success. I've tried leaving bootstrap empty, or keep my router-components in the entry collection, but no module config seems to work.
Angular seems bent on having a main component to bootstrap.
Normally you would bootstrap the AppComponent, whos template is anything + <router-outlet> in some place, in the AppModule. Afterwards you would initialize the AppModule as entry point.
Without a main component as entry point I cant imagine how could you tell angular what should be the entry point of the application.
I would say its not possible. When you declare a component in bootstrap in the AppModule, angular will look for its css selector in index.html. If not found -> error. In the other hand, if you dont declare anything inside of the bootstrap section in your app module -> error. Furthermore, if you try to bootstrap the RouterOutet directive in your app module
Uncaught Error: RouterOutlet cannot be used as an entry component.
Also the following quote from the NgModule FAQ seems to support this:
You can embed the child components in the top component's template. Alternatively, make the top component a routing host by giving it a
<router-outlet>. Define child routes and let the router load module components into that outlet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With