0 votes
in Angular by
How do you manually bootstrap an application?

1 Answer

0 votes
by

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
  }
}
...