To take control of this process at the bootstrap level, utilizing the Angular bootstrap interface is the way to go.
https://angular.io/api/core/DoBootstrap
Start by removing or emptying the bootstrap property in the app module.
Next, implement the DoBootstrap interface and provide an implementation for the ngDoBootstrap method. Based on your specific business requirements, determine which component should be included.
In the index.html file, make sure to update the body tag as shown below.
<body> <div id="bassApp"></div></body>
The App Module will appear as follows:
@NgModule({
declarations: [
AppComponent,
Component1,
Component2,
Component3
],
imports: [
BrowserModule,
AppRoutingModule
],
providers: [],
bootstrap: []
})
export class AppModule implements DoBootstrap{
ngDoBootstrap(appRef: ApplicationRef): void {
// Modify the component that needs to be injected based on your logic
appRef.bootstrap(Component1, document.getElementById('bassApp'))
}
}