Performance: How Angular bootstraps an application
This affects the initial page load speed and time to interactive by controlling how Angular initializes and renders the app.
bootstrapApplication(AppComponent).catch(err => console.error(err));
platformBrowserDynamic().bootstrapModule(AppModule).catch(err => console.error(err));
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Dynamic bootstrapModule | High (loads full module tree) | Multiple reflows during init | High paint cost due to delayed render | [X] Bad |
| Standalone bootstrapApplication | Lower (only root component) | Single reflow after init | Lower paint cost, faster render | [OK] Good |
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
bootstrapApplication(AppComponent);import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
platformBrowserDynamic().bootstrapModule(AppComponent);RootComponent. Which is the best way to do this considering Angular 17+ standards?bootstrapApplication(RootComponent); to start the app uses bootstrapApplication() with RootComponent, the recommended way.platformBrowserDynamic().bootstrapModule(AppModule); uses module bootstrap, which is valid but not best for standalone. The other options use invalid syntax.Pass the test and this pattern moves unknown