Angular & Signals (283 Qs)•Part 9: NgModules, Providers, NgZone & Injector Hierarchies (213 - 255)
How do you manually bootstrap an application?
You can use ngDoBootstrap hook for a manual bootstrapping of the application instead of using bootstrap array in @NgModule annotation. This hook is part of DoBootstrap interface.
js
interface DoBootstrap {
ngDoBootstrap(appRef: ApplicationRef): void
}
The module needs to be implement the above interface to use the hook for bootstrapping.
js
class AppModule implements DoBootstrap {
ngDoBootstrap(appRef: ApplicationRef) {
appRef.bootstrap(AppComponent); // bootstrapped entry component need to be passed
}
}