Reputation: 151
when launching angular with a standalone component like
bootstrapApplication(AppComponent,{...
how can we set the ngZone parameter
With modules it goes like:
platformBrowserDynamic() 👇
.bootstrapModule(AppModule, { ngZone: 'noop' })
but I did not see a way to do the same with bootstrapApplication()
Upvotes: 11
Views: 3713
Reputation: 1
// standalone bootstrap
bootstrapApplication(App, {providers: [
provideExperimentalZonelessChangeDetection(),
]});
for more info: https://angular.dev/guide/experimental/zoneless
Upvotes: 0
Reputation: 1419
Unfortunately, there's no option for it at the moment (v15)
This was a deliberate choice we made when designing bootstrapApplication - we chose to create a minimal API that didn't carry over any of the options from the bootstrapModule API.
ngZone: 'noop' is what I would consider an advanced, low-level option. It's not something you can just set - using this option requires completely rethinking how state works in your application and how change detection is triggered.
For now, continue to use bootstrapModule if you require a zoneless application. Reactivity, Change Detection, and "zoneless" is an area of focus for us in 2023, so we hope to have a real story here at some point.
More details and workaround could be found here: https://github.com/angular/angular/issues/47538
Upvotes: 5