Commit graph

3411 commits

Author SHA1 Message Date
Kristiyan Kostadinov
583b9a7be5 fix(core): missing useExisting providers throwing for optional calls (#61137)
Fixes that the runtime was throwing a DI error when attempting to inject a missing `useExisting` provider, despite the call being optional.

The problem was that when the provider has `useExisting`, we do a second `inject` call under the hood which didn't include the inject flags from the original call.

Fixes #61121.

PR Close #61137
2025-05-06 09:12:38 -07:00
Foysol Ahmed
5fe726dd45 docs: ViewContainerRef.createComponent jsdoc update (#61097)
Co-authored-by: Jessica Janiuk <1596273+thePunderWoman@users.noreply.github.com>
PR Close #61097
2025-05-02 07:57:10 -07:00
KryptonBD
0b6c8dc72d docs: ViewContainerRef.createComponent jsdoc update to reflect actual behavior (#61097)
Fixes #59918

PR Close #61097
2025-05-02 07:57:09 -07:00
Matthieu Riegler
f580318411 docs(docs-infra): Add version of introduction for APIs (#60814)
For new APIs we'll mention since when a particular API is in its current status (experimental, devPreview, stable)

fixes #49668

PR Close #60814
2025-05-02 07:51:33 -07:00
arturovt
d2cb0b9786 refactor(core): tree-shake getDirectiveDef error (#61075)
This commit (25cae4555a) introduced an error throw when the directive definition is not defined. We can guard it with `ngDevMode` and throw the error only in development mode.

PR Close #61075
2025-05-01 08:43:43 -07:00
Matthieu Riegler
c2c8b75d7b refactor(core): remove module bootstrap code when using standalone. (#59208)
This commit improves tree shaking in standalone apps.

PR Close #59208
2025-05-01 08:39:34 -07:00
Alan Agius
193bd7c54a fix(core): properly handle app stabilization with defer blocks (#61040)
Previously, the app was marked as stable prematurely. For more details, see https://github.com/angular/angular/issues/61038#issuecomment-2837917180

Closes: #61038

PR Close #61040
2025-04-30 12:37:02 -07:00
arturovt
624be2ef0c fix(core): prevent stash listener conflicts (#59635)
The stash event listener is a global function that might be unsafely overridden if multiple microfrontend applications exist on the page.

In this commit, we create a map of `APP_ID` to stash event listener functions. This map prevents conflicts because multiple applications might be bootstrapped simultaneously on the client (one rendered on the server and one rendering only on the client).

I.e., the code that might be used is:

```ts
// Given that `app-root` is rendered on the server
bootstrapApplication(AppComponent, appConfig);

bootstrapApplication(BlogRootComponent, appBlogConfig);
```

Two bootstrapped applications would conflict and override each other's code.

PR Close #59635
2025-04-30 08:53:06 -07:00
arturovt
b14fbe1497 refactor(core): tree-shake getNgModuleDef error (#60339)
Currently, the error thrown in `getNgModuleDef` is guarded by `throwIfNotFound`, which is only set to `true` when `ɵɵsetNgModuleScope` is called in production. In all other cases, `throwIfNotFound` is never used in production. This means that if NgModules aren't used, `getNgModuleDef` is never called with the second argument. We can split it into two functions to allow tree-shaking of the error when NgModules aren't used at all.

PR Close #60339
2025-04-30 08:50:52 -07:00
cexbrayat
52e2f0842d refactor(core): remove unused APP_EFFECT_SCHEDULER in effect code (#59679)
The `APP_EFFECT_SCHEDULER` Injection token is never used and not a public API.

PR Close #59679
2025-04-30 08:49:55 -07:00
vladboisa
a282f583ed docs: add link label & paragraph for correct display (#60708)
PR Close #60708
2025-04-30 08:18:07 -07:00
vladboisa
e4a667690a docs: add Security-DomSanitizer link in ElemnetRef&Renderer2 (#60708)
Renderer2 and ElementRef didn't mention the Security-DomSanitizer method, this will add clarity for potential user what to expect. Also swap deprecated "callout" class to docs-alert

Fixes #51208 , #46904

PR Close #60708
2025-04-30 08:18:07 -07:00
arturovt
8d82a39a60 fix(core): async EventEmitter error should not prevent stability (#61028)
This commit wraps the `fn` invocation with `try-finally`, ensuring that the pending task (added in [this commit](d5c6ee432f)) is always removed.

Prior to this commit, if a subscriber threw an error, it would prevent the application from becoming stable — though this shouldn't happen under normal scenarios because the error should be handled by the RxJS error handler or Angular's error handler.

Errors should not silently prevent the application from being rendered on the server.

PR Close #61028
2025-04-29 22:14:15 -07:00
Matthieu Riegler
e6a34277fc feat(devtools): defer blocks support (#60629)
This commit adds the support for defer block in the Angular DevTools.

@defer block are now visible in the directive tree and give access to defer & hydration details.

This feature also brings support of incrementation hydration.

PR Close #60629
2025-04-29 22:07:47 -07:00
Andrew Scott
3261d14391 refactor(core): NgZone.onError reports to application error handler (#60946)
This commit ensures that errors from the `NgZone.onError` subscription
in bootstrap are reported to the internal application error handler.
Practically speaking, this should not affect anything today, as the
application handler goes directly to the `ErrorHandler` from the root.
While TestBed installs an application error handler that rethrows,
`TestBed.createComponent` does not create components through this
bootstrap function.

PR Close #60946
2025-04-29 21:56:50 -07:00
Andrew Scott
c801c74c09 refactor(core): Remove zoneless change detection re-export (#61029)
removes the experimental re-export from zoneless provider

PR Close #61029
2025-04-29 10:31:18 -07:00
Pawel Kozlowski
d8fbb909ce feat(core): rename afterRender to afterEveryRender and stabilize (#60999)
This change renames the afterRender to afterEveryRender and marks the
renamed API as stable.

BREAKING CHANGE: afterRender was renamed to afterEveryRender.

PR Close #60999
2025-04-28 12:33:55 -07:00
Andrew Scott
7680a27f30 refactor(core): Ignore errors related to updating exhaustive check value (#61027)
this can happen if the injector is already destroyed, which can happen in tests that fail to clean up correctly

PR Close #61027
2025-04-28 10:16:01 -07:00
arturovt
77174680b2 refactor(core): tree-shake NOT_SET and EMPTY_CLEANUP_SET (#60979)
Adds `__PURE__` annotations to `NOT_SET` and `EMPTY_CLEANUP_SET` to enable tree-shaking, even if they are not referenced. These variables are not dropped when Angular is imported from a module that has `sideEffects` set to `true`.

PR Close #60979
2025-04-25 08:42:12 -07:00
Andrew Scott
e711f99d81 feat(core): move provideExperimentalCheckNoChangesForDebug to provideCheckNoChangesConfig (#60906)
This commit makes several changes changes to the
`provideExperimentalCheckNoChangesForDebug` API:

* Rename it
* Promote to dev preview
* Apply the exhaustive behavior to _all_ checkNoChanges runs
* Remove `useNgZoneOnStable` option. This wasn't found to be generally
  more useful than `interval`

fixes #45612

BREAKING CHANGE: `provideExperimentalCheckNoChangesForDebug` has several
breaking changes:
* It is renamed to `provideCheckNoChangesConfig`
* The behavior applies to _all_ checkNoChanges runs
* The `useNgZoneOnStable` option is removed. This wasn't found to be generally
  more useful than `interval`

PR Close #60906
2025-04-24 13:04:27 -07:00
Andrew Kushnir
c2987d8402 refactor(core): stop producing ng-reflect attributes by default (#60973)
BREAKING CHANGE:

This commit deprecates `ng-reflect-*` attributes and updates the runtime to stop producing them by default. Please refactor application and test code to avoid relying on `ng-reflect-*` attributes.

To enable a more seamless upgrade to v20, we've added the `provideNgReflectAttributes()` function (can be imported from the `@angular/core` package), which enables the mode in which Angular would be producing those attribites (in dev mode only). You can add the `provideNgReflectAttributes()` function to the list of providers within the bootstrap call.

PR Close #60973
2025-04-24 10:07:35 -07:00
Alex Rickabaugh
d0c9a6401a refactor(core): rename resource's request to params (#60919)
As decided in the resource RFC, this commit renames the `request` option of
a resource to `params`, including the subsequent argument passed to the
loader. It also corrects the type in the process to properly allow narrowing
of the `undefined` value.

Fixes #58871

PR Close #60919
2025-04-23 19:34:50 +00:00
Alex Rickabaugh
d8ca560a15 refactor(core): convert ResourceStatus to a string type (#60919)
An outcome of the Resource RFC was that we should use string constants for
communicating the resource status instead of an enum. This commit converts
`ResourceStatus` accordingly.

PR Close #60919
2025-04-23 19:34:50 +00:00
arturovt
0ac949c266 fix(core): do not run change detection on global error events (#60944)
This commit wraps the `error` and `unhandledrejection` event listeners so they are installed outside of the Angular zone, because otherwise they trigger change detection whenever the event callbacks are invoked.

PR Close #60944
2025-04-23 15:17:28 +02:00
Andrew Scott
953c4b2580 feat(core): Move zoneless change detection to dev preview (#60748)
This commit moves zoneless from experimental to developer preview.

* Update tag on provider API
* Remove "experimental" from provider name
* Move documentation from "experimental features" to "Best practives ->
  Performance" (at least temporarily until there is a better place)

BREAKING CHANGE: `provideExperimentalZonelessChangeDetection` is
renamed to `provideZonelessChangeDetection` as it is now "Developer
Preview" rather than "Experimental".

PR Close #60748
2025-04-23 11:47:56 +02:00
Pawel Kozlowski
5efc6927c5 refactor(core): alias afterRender to afterEveryRender (#60951)
Introduce an alias from afterRender to afterEveryRender in preparations for the
the internal rename.

PR Close #60951
2025-04-23 10:07:52 +02:00
Jeevan Mahesha
9deaa674e6 docs: replace EventEmitter with output and self-closing tags in templates (#60910)
Replaced all instances of EventEmitter with the new output() utility.
Updated templates to use self-closing tags for cleaner markup.

PR Close #60910
2025-04-22 21:42:18 +02:00
Matthieu Riegler
6c2fbad8a2 refactor(core): Improve NG0600 error message. (#60418)
This commit adds the mention of templates as illegal context to write signals.

fixes #60143

PR Close #60418
2025-04-22 16:35:38 +02:00
Matthieu Riegler
00dff8bfd6 refactor(core): mark makeEnvironmentProviders as public. (#60956)
`makeEnvironmentProviders` was already exported but didn't have the `@publicApi` tag.

PR Close #60956
2025-04-22 16:27:22 +02:00
Matthieu Riegler
b43fe29ca7 docs: update examples for i18n tokens (#60938)
PR Close #60938
2025-04-22 11:14:13 +02:00
Matthieu Riegler
8d31b0065e docs: update docs centered on NgModules (#60933)
PR Close #60933
2025-04-22 11:08:54 +02:00
Jessica Janiuk
567522398f feat(core): stabilize incremental hydration api (#60888)
This removes the developer preview label for incremental hydration APIs.

PR Close #60888
2025-04-16 13:00:44 -04:00
Matthieu Riegler
ba34b3c3d9 refactor(core): remove unused injection props (#59209)
Those were also properties that were kept to also support of old compiled targets.

PR Close #59209
2025-04-15 17:33:02 -04:00
Andrew Scott
65adb3024d feat(core): Add provider which reports unhandled errors on window to ErrorHandler (#60704)
This commit adds a provider that installs listeners on the browser
window to forward unhandled promise rejections and uncaught errors to
the `ErrorHandler`. This is useful for both ZoneJS and Zoneless
applications. For apps using ZoneJS, errors can reach the window when
they happen outside the Angular Zone. For Zoneless apps, any errors not
explicitly caught by the framework can reach the window. Without this
provider, these errors would otherwise not be reported to
`ErrorHandler`.

We will/should consider adding this provider to apps by default in the
cli. In addition, it should be mentioned in the (to be created)
documentation page on error handling in Angular.

relates to #56240

PR Close #60704
2025-04-14 14:33:00 -04:00
Pawel Kozlowski
c1bcae91dd feat(core): expose performance data in Chrome DevTools (#60789)
This commit exposes the enableProfiling() function which enables
performance data visualisation directly in the Chrome DevTools
performance panel.

PR Close #60789
2025-04-14 11:12:55 -04:00
Matthieu Riegler
333d4e3bab refactor(core): Promote afterRenderEffect to stable (#60854)
`afterRenderEffect` in an `effect` that runs after rendering.

PR Close #60854
2025-04-14 11:08:44 -04:00
Pawel Kozlowski
727cda3856 feat(core): mark linkedSignal API as public (#60865)
Follow up on the PR https://github.com/angular/angular/pull/60741

PR Close #60865
2025-04-14 11:05:28 -04:00
Matthieu Riegler
7b8c2fa2b2 refactor(core): Promote afterNextRender to stable. (#60792)
`afterRender` will not be promoted and is on its way out.

PR Close #60792
2025-04-11 07:09:03 -04:00
Matthieu Riegler
36ae560765 refactor(core): remove the phase prop from AfterRenderOptions (#60641)
The `AfterRenderPhase` enum now becomes private, it isn't exported anymore.

PR Close #60641
2025-04-09 15:39:47 -07:00
Matthieu Riegler
0b69b61929 fix(core): Flush animations when no component has been checked (#58089)
When Angular runs application synchronization automatically, animations
are now guaranteed to be flushed, regardless of whether change detection
was run on any components attached to `ApplicationRef`. This most
frequently affects animations related to component removal where the DOM
element for the component would previously not be removed due to
animations not being flushed

BREAKING CHANGE: Animations are guaranteed to be flushed when Angular
runs automatic change detection or manual calls to `ApplicationRef.tick`.
Prior to this change, animations would not be flushed in some situations
if change detection did not run on any views attached to the
application. This change can affect tests which may rely on the old
behavior, often by making assertions on DOM elements that should have
been removed but weren't because DOM removal is delayed until animations
are flushed.

fixes #58075

PR Close #58089
2025-04-09 11:12:54 -07:00
Pawel Kozlowski
2b4fd9b273 refactor(core): allow multiple DI profilers (#60562) (#60562)
This commit changes the DI profiler infrastructure to
allow multiple profilers running at the same time.

PR Close #60562

PR Close #60562
2025-04-09 09:16:40 -07:00
Andrew Scott
b8d9f95faa Revert "refactor(core): allow multiple DI profilers (#60562)" (#60793)
This reverts commit 56cc5fdb57.

CI tests are consistently timing out after this commit

PR Close #60793
2025-04-08 14:04:16 -07:00
Matthieu Riegler
2c6b697e4c refactor(core): promote effect to stable. (#60773)
`effect` is promoted to stable in v20

PR Close #60773
2025-04-08 09:16:38 -07:00
Pawel Kozlowski
56cc5fdb57 refactor(core): allow multiple DI profilers (#60562)
This commit changes the DI profiler infrastructure to
allow multiple profilers running at the same time.

PR Close #60562
2025-04-08 08:56:30 -07:00
Doug Parker
0ae1889560 fix(core): run ApplicationRef.prototype.bootstrap in NgZone (#60720)
`bootstrapApplication` always creates the root component in the `NgZone`, however `ApplicationRef.prototype.bootstrap` historically did not, meaning that if users did not go out of their way to call `ngZone.run(() => appRef.bootstrap(SomeComp))`, components would not run change detection correctly.

This commit updates `ApplicationRef.prototype.bootstrap` to _always_ run within `NgZone`, removing this hazard and ensuring components always run CD as expected.

PR Close #60720
2025-04-07 11:32:31 -07:00
Pawel Kozlowski
8d050b5bfc feat(core): stabilize linkedSignal API (#60741)
The linkedSignal API is now considered stable.

PR Close #60741
2025-04-04 10:35:51 -07:00
Andrew Kushnir
491818f51f docs: mark REQUEST and related symbols as stable (#60717)
This commit removes the `@developerPreview` annotation from the `REQUEST`, `RESPONSE_INIT` and `REQUEST_CONTEXT` symbols, making them stable.

PR Close #60717
2025-04-03 13:04:23 -07:00
Doug Parker
2348f26d8a refactor(core): add ApplicationRef.prototype.bootstrapImpl with an injector parameter (#60622)
This is a roll forward of commit d5a8a1c524. Nothing is meaningfully different, as we're trying again to see if the CI failure is reproducible.

PR Close #60622
2025-04-03 10:48:01 -07:00
Andrew Scott
866cea9a05 feat(core): Stabilize PendingTasks Injectable (#60716)
This PR marks `PendingTasks` as stable, though the `run` function
remains in dev preview. There are still questions around its return
value, error handling, and whether it will be replaced by a different
`task` API that would better track context through the
injector/injection context.

PR Close #60716
2025-04-03 10:11:15 -07:00
Matthieu Riegler
1c1ad12ad3 refactor(core): Instantiate the ErrorHandler lazily. (#58984)
This change prevents that user code in a custom `ErrorHandler` to run as part of `ApplicationRef`'s creation.

fixes #58970

PR Close #58984
2025-04-02 19:20:50 +00:00