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 DoBootstap interface.

interface DoBootstrap {
ngDoBootstrap(appRef: ApplicationRef): void;
}

The module needs to be implement the above interface to use the hook for bootstrapping.

class AppModule implements DoBootstrap {
ngDoBootstrap(appRef: ApplicationRef) {
appRef.bootstrap(AppComponent); // bootstrapped entry component need to be passed
}
}

Author of content
Edit this page

Made by Michael Sakhniuk

Twitter