Remove the registered pending task when an interceptor chain throws before
returning an Observable. Preserve the original error for the caller and keep
finalize responsible for completion, Observable errors, and cancellation.
Apply cleanup to both the outer HTTP handler and the legacy interceptor
adapter, since each registers its own task that can otherwise block stability.
Add tests for synchronous errors, Observable errors, completion, and
unsubscribe with both functional and legacy interceptors.
Closes#71953
`KeyValuePipe` sorted its output in place, so when `compareFn` switched
from a function to `null` without the input changing, the original order
was lost and the previously sorted array was returned.
When only `compareFn` changes, rebuild the entries from the input in
natural order before applying the new comparator. Tested with new specs
for objects and Maps that fail without the fix.
Fixes#71893
`httpResource` is initialized via a top-level IIFE so that sub-constructors
(`arrayBuffer`, `blob`, `text`) can be attached to the function object.
Without a `/* @__PURE__ */` annotation, Closure Compiler and other bundlers
treat this top-level IIFE as potentially side-effectful, retaining `httpResource`
and its transitive dependencies even when unused.
Provide cache lookup through the existing private transfer-cache options so httpResource clients without transfer caching do not retain cache restoration and hashing.
Preserve the optional dependency lookups, their timing, and synchronous hydration behavior. Update the http bundle golden to show the removal of the cache-related symbols.
Previously, `generate_api_docs(...)` targets lived directly in each
`//packages/**/BUILD.bazel` file (and `render_api_to_html(...)` in
`//tools/manual_api_docs/{blocks,elements}/BUILD.bazel`). Because
`render_api_to_html` validates links against
`//adev/scripts/routes:defined-routes.json`, running wildcard package
builds or tests such as `bazel test //packages/forms/...` pulled in the
`//adev/...` route generation and API manifest dependency graph across
all packages.
Move all framework `generate_api_docs` and manual API `render_api_to_html`
targets into `//adev/src/content/api` alongside `aria`, `cdk`, and `cli`,
leaving only lightweight `files_for_docgen` filegroups in `//packages/...`
and JSON extraction targets in `//tools/manual_api_docs/...`. Remove the
`generate_api_docs` wrapper from `//tools:defaults.bzl` so neither
`//packages/...` nor `//tools/...` loads or depends on `//adev/...`, and
add `//adev/src/content/api:api_docs_test` so `bazel test //adev/...`
explicitly exercises API doc generation and link validation.
Removes unnecessary `changeDetection: ChangeDetectionStrategy.Eager` from test components where default `OnPush` change detection works or where state updates can use signals, removes unnecessary `provideZoneChangeDetection()`, replaces `fixture.detectChanges()` with `await fixture.whenStable()` where appropriate, and cleans up redundant `forwardRef`/`CommonModule` imports and unused selectors.
The API reference only attaches a `@param` description to a parameter
when the names match. Several APIs documented parameters under a
different name than the one in the signature, so angular.dev rendered
those parameters with an empty description.
Update the JSDoc to use the actual parameter names:
- core: `ViewContainerRef.move()` documented `index` instead of
`currentIndex`.
- core: `inject()` still documented the `flags` parameter, which was
replaced by `options` when `InjectFlags` was removed from the public
API. Use the same description as the other `inject()` overloads.
- core: `twoWayBinding()` documented `eventName` instead of `publicName`.
- common: `Location.subscribe()` documented `value` and `exception`
instead of the `onNext` and `onThrow` callbacks, and didn't document
`onReturn`.
- common/upgrade: `UrlCodec.encodeSearch()`, `decodeSearch()`,
`encodeHash()` and `decodeHash()` documented `path` instead of
`search` or `hash`, and the first `normalize()` overload documented
`path` instead of `href`. Also fix a "has string" typo.
- router: `DefaultTitleStrategy.updateTitle()` documented a `title`
parameter instead of `snapshot`. Also update its description, since
it builds the title from the router state rather than setting a
given value.
- forms: `minDate()` and `maxDate()` documented `minDate` and `maxDate`
instead of `minDateValue` and `maxDateValue`.
Verified by rebuilding the docs with `//adev:build` and checking that
each of these parameters now has a description in the generated API
reference pages, and that no other `@param` name mismatches remain
besides `IterableChanges.forEachOperation` (which documents its
callback's arguments) and the `QueryList` constructor.
The parameter encoding was using a plain object literal lookup to determine how to encode specific characters. This makes it vulnerable to prototype pollution.
These changes mitigate the issue by storing the mapping in a native `Map` instead.
NgOptimizedImage declares a `srcset` input, so a `[srcset]="..."` binding
is captured by the directive and never reaches the `<img>` element. The
directive only reads that input for a conflict check, so with
`disableOptimizedSrcset` the image ended up with no `srcset` at all. The
only way to set one was `[attr.srcset]`.
Now, when `disableOptimizedSrcset` is set and the directive isn't
generating its own srcset, the value from the `[srcset]` binding is
written back to the element.
Fixes#49335
`HttpClient` split `reportProgress` into `reportUploadProgress` and
`reportDownloadProgress`, but `httpResource` still passed its
`reportProgress` option to the deprecated `reportProgress` of
`HttpRequest`.
The `progress` signal of `httpResource` only tracks download events, so
`reportProgress` there already means download progress. Forward it as
`reportDownloadProgress` instead of adding a new option.
A bare url in a `@see` tag (e.g. `@see https://...`) matches neither the markdown nor the `{@link}` format, so it was silently dropped from the rendered docs. Now that the extractor recovers the `http(s)` prefix stripped by TypeScript, throw an error asking for a labeled markdown link instead.
Also convert the only bare `@see` url in the public API (`Location.historyGo`) to a markdown link.
httpResource registers an 'abort' listener on the resource's AbortSignal
to unsubscribe the underlying request when it's cancelled. The listener
was only removed from the subscription's own error/complete callbacks,
but calling sub.unsubscribe() directly - which is exactly what happens
when the listener itself fires - doesn't trigger those callbacks. So on
the one path where the signal actually aborts, the listener was never
removed.
Passing { once: true } lets the removal happen automatically once the
listener fires, covering that path without touching the existing
error/complete cleanup, which is still needed for the paths where the
request finishes without ever aborting.
This also happens to route around a real leak on affected engines: an
AbortSignal that's had any listener attached isn't garbage collected
until it fires. https://bugs.webkit.org/show_bug.cgi?id=298499
Replaces the remaining hand-rolled deferred promise implementations
with the native `Promise.withResolvers()` API and removes the now
unused helper and import.
Follow-up to #69739.
`getTagSinceVersion` matched `\d+(\.\d+)?` anywhere in the tag comment. That
works for `@developerPreview`, `@experimental` and `@stable`, whose comment is
only a version, but `@deprecated` also carries a message, so any number in the
prose won. https://angular.dev/api/common/getLocaleCurrencyCode reads
"deprecated since v4217", taken from "a map of locale to ISO 4217 currency
codes", and eighteen sibling pages take v18 from the "i18n" in "relying on the
`Intl` API for i18n".
Anchoring the match, and allowing the `since`/`from`/`as of` prefixes the
comments use, leaves all seventy-nine correctly versioned comments untouched.
`generate_manifest` carries its own copy of the regex, so the API list badges
had the same values.
Those `@angular/common` comments never stated a version, so they now say `18.0`
explicitly, the release `d34c033902` (#54483) first shipped in, matching the
`@deprecated 18.0` already on `FormatWidth` in the same file. Nine tags in that
file had no version at all and were showing no badge; they are from the same
commit and now say `18.0` too.
Preserve hasUAVisualTransition through Location and the Router navigation pipeline. This prevents withViewTransitions from starting an author transition after the browser has already performed one, including across redirects and when using experimental platform navigation.
We keep getting PRs that target single usages of `hasOwnProperty` and we have ~100 of them. These changes aim to address the issue centrally by swapping out all the instances and adding a lint rule against introducing new ones.
Previously, when you passed an object typed like
Record<'a' | 'b', number> into the `keyvalue` pipe, TypeScript would
"forget" that the keys could only ever be 'a' or 'b', and just tell
you the key was a plain `string` instead. So code like this used to
fail to compile, even though it's correct:
```ts
const input: Record<'a' | 'b', number> = {a: 1, b: 2};
const result = pipe.transform(input);
const key: 'a' | 'b' = result[0].key; // error: string is not 'a' | 'b'
```
This happened because the pipe has multiple overloaded versions of
transform(), and TypeScript checks them top to bottom, using the
first one that matches. The "number keys" overload was listed first,
and it happened to also match string-keyed objects by accident, so
it "won" before the correct "string keys" overload ever got a
chance to run.
The fix just reorders those two overloads so the string-keys one is
checked first. Nothing about runtime behavior changes — objects with
actual numeric keys (e.g. Record<1 | 2, string>) still correctly
report their keys as plain `string`, matching what Object.keys()
really returns at runtime.
Cancel the unread response body before reporting NG02825 when its declared Content-Length exceeds the configured buffer limit. Without cancellation, SSR can finish while the underlying connection remains open.
Add regression coverage for the declared-length rejection path.
Prevent AbortController.abort() from executing during Observable teardown when a FetchBackend HTTP request has already completed successfully or errored.
Previously, FetchBackend unconditionally called abort() upon stream termination. When requests completed normally, calling abort() after delivery caused Chromium-based browsers to mark the resolved request as net::ERR_ABORTED in DevTools due to a race condition, leading to missing response body payloads ("Failed to load response data"). By tracking whether the request has already settled—similar to XhrBackend checking for xhr.readyState !== xhr.DONE—we ensure abort() is only called for unsettled, in-flight requests upon unsubscription.
Fixes#70071