-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to configure NgZone in bootstrapApplication
#49557
Conversation
a530706
to
73bb819
Compare
…oviders This commit updates the `bootstrapApplication` method to get the `NgZone` instance from DI. This will allow a future change to enable developers to configure `NgZone` in DI rather than adding the options to the top level like in `bootstrapModuleFactory` (which is done in order to get the NgZone instance without going through DI).
This commit adds a provider function that allows developers to configure the `NgZone` instance for the application. In the future, this provider will be used for applications to specifically opt-in to change detection powered by ZoneJS rather than it being provided by default. This API does _not_ specifically provide support for developers to define their own `NgZone` implementation or opt in to `NoopNgZone` directly. Both of these are possible today, but are effectively unsupported (applications that use these are left to their own devices to run change detection at the appropriate times). That said, developers can still use DI in `bootstrapApplication` to provide an `NgZone` implementation instead, it's just not specifically available in the `provideZoneChangeDetection` function.
73bb819
to
36bdbe8
Compare
434937d
to
035adea
Compare
if ((typeof ngDevMode === 'undefined' || ngDevMode) && | ||
moduleRef.injector.get(PROVIDED_NG_ZONE, null) !== null) { | ||
throw new RuntimeError( | ||
RuntimeErrorCode.PROVIDER_IN_WRONG_CONTEXT, | ||
'`bootstrapModule` does not support `provideZoneChangeDetection`. Use `BootstrapOptions` instead.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-for: public-api
36220a2
to
788c1e0
Compare
caretaker: TAP failures are pre-existing |
This PR was merged into the repository by commit d7d6514. |
…n` (#49557) This commit adds a provider function that allows developers to configure the `NgZone` instance for the application. In the future, this provider will be used for applications to specifically opt-in to change detection powered by ZoneJS rather than it being provided by default. This API does _not_ specifically provide support for developers to define their own `NgZone` implementation or opt in to `NoopNgZone` directly. Both of these are possible today, but are effectively unsupported (applications that use these are left to their own devices to run change detection at the appropriate times). That said, developers can still use DI in `bootstrapApplication` to provide an `NgZone` implementation instead, it's just not specifically available in the `provideZoneChangeDetection` function. PR Close #49557
Hooray! |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
see individual commits