How to disable zone.js in a standalone angular apllication?
Asked Answered
G

1

11

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()

Gyimah answered 26/12, 2022 at 14:48 Comment(0)
K
5

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

Krell answered 26/12, 2022 at 20:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.