38449 Commits

Author SHA1 Message Date
Andrew Scott 2eae497a04 feat(compiler-cli): support external TCBs with copied content in specific mode
This change adds a new  that allows environments that cannot support inline TCBs (such as the language service or source-to-source transforms where TS compilation and emit are downstream) to still perform template type checking.

    Instead of inlining the TCB into the original source file when non-exported symbols are referenced, we now copy the file content to the .ngtypecheck.ts shim file and generate the external TCB there, if requested by the inlining mode. This preserves the local scope of the original file while keeping the original file unmodified.
2026-04-29 16:08:33 -07:00
Alon Mishne 12d4844c8b release: cut the v22.0.0-next.10 release v22.0.0-next.10 2026-04-29 16:03:12 -07:00
Alon Mishne 662560effc docs: release notes for the v21.2.11 release 2026-04-29 15:40:46 -07:00
Kam 13c0422029 docs(docs-infra): open update guide external links in new tabs
External links in the update guide opened inconsistently. Override
marked's link renderer to add `target="_blank" rel="noopener noreferrer"`
to external anchors and apply the `external-link-with-icon` mixin for
the icon. Convert raw HTML and bare URLs in recommendations.ts to
markdown so they all flow through the renderer.
2026-04-29 13:59:42 -07:00
Kam 2101b13653 docs: document allowedHosts SSR requirement in v21 update guide
The GHSA-x288-3778-4hhx patch requires `allowedHosts` on
`CommonEngine` or SSR silently falls back to CSR. Add a checklist
item to the v21 update guide.
2026-04-29 13:59:12 -07:00
Angular Robot 82890dd9f5 docs: update cross-repo adev docs
Updated Angular adev cross repo docs files.
2026-04-29 13:58:03 -07:00
Andrew Scott af24a4ae3a fix(vscode-extension): Look for tsdk override in the new js/ts.tsdk.path setting
recent versions of vscode use js/ts.tsdk.path rather than typescript.tsdk

relates to #68423
2026-04-29 13:39:15 -07:00
Bhuvansh855 9f7d41f296 docs: improve clarity in dependency injection guide 2026-04-29 13:38:17 -07:00
Alan Agius 0f7086add4 docs: update documentation for platform server URL token options
This `baseUrl` option is not available.
2026-04-29 13:36:59 -07:00
Andrew Scott c70625e806 refactor(compiler-cli): remove reflectionhost from environment
all necessary info is already available in the tcb meta objects. environments without full ts program no longer need a reflectionhost for tcb generation
2026-04-29 13:36:21 -07:00
splincode 54a985c5ca refactor(forms): replace any with unknown in interop control value types
- `CombinedControl.value` and `InteropNgControl.value` getter now return
  `unknown` instead of `any`, matching the actual `ReadonlyFieldState<unknown>`
  return type of `controlValue()`.
- Remove redundant `as any` cast in `cvaControlCreate`: `parent` is typed as
  `FormField<unknown>`, so `state().controlValue` is `WritableSignal<unknown>`
  and accepts `unknown` directly.
2026-04-29 13:35:48 -07:00
Ben Hong 18826de489 docs: add debouncing section to signal forms async operations
Co-authored-by: Matthieu Riegler <kyro38@gmail.com>

Co-authored-by: Matthieu Riegler <kyro38@gmail.com>

Co-authored-by: Matthieu Riegler <kyro38@gmail.com>
2026-04-29 13:35:18 -07:00
Angular Robot 37ba0a79a6 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-04-29 13:34:08 -07:00
Matthieu Riegler 37ec63e745 refactor(compiler): introduce default constant for legacyOptionalChaining flag
This will help patch the value in G3 to help land this change.
2026-04-29 10:01:13 -07:00
Matthieu Riegler 2896c93cc1 feat(compiler): Angular expressions with optional chaining returns undefined
To mitigate this breaking change,  this behavior can be disabled by wrapping expressions with the `$null` magic function.
: `$null(foo?.bar?.baz)`
2026-04-28 15:26:53 -07:00
Matthieu Riegler ef38017418 build: move devtools only deps out of the workspace
This reduces the clutering of the workspace package.
2026-04-28 13:05:33 -07:00
aparziale 8f8972b0fd feat(migrations): model + output migrations
becomes input + linkedSignal

When a component has both a model() property and a conflicting output property (e.g., foo model + fooChange output), this migration converts the model() to an input() + linkedSignal() pattern to avoid naming conflicts.

Fixes #67340
2026-04-28 12:43:55 -07:00
SkyZeroZx 97cac1cf4d fix(common): prevent focus from scrollToAnchor
Focus the target element using `focus({preventScroll: true})` after scrolling, so the browser doesn’t adjust the scroll position when applying focus.

Fixes #65938
2026-04-28 12:39:26 -07:00
Angular Robot f5b139f5b8 docs: update cross-repo adev docs
Updated Angular adev cross repo docs files.
2026-04-28 12:33:28 -07:00
Denis Balan 5dfe37df8e docs: Fix links to Firebase AI Logic Angular example 2026-04-28 12:10:48 -07:00
Suraj Yadav f2c6445681 docs(forms): add NG01902 error reference and link to docs
Add the NG01902 (Orphan field in signal forms) documentation page
to the Error Encyclopedia and change the ORPHAN_FIELD_PROPERTY
error code to -1902 so Angular's RuntimeError automatically appends
a link to angular.dev/errors/NG01902 in the thrown error message.
2026-04-28 12:07:46 -07:00
Matthieu Riegler 8c11816490 fix(core): fix ordering of view queries metadata in JIT mode
AOT was generating an array that was ordered as signal queries first, then the decorator queries.
Aligning JIT with AOT fixes the issue illustrated by the test.

fixes #68404
2026-04-28 12:03:41 -07:00
Kam a6eb55642c docs: use contentChildren() in component harness example
The example already uses the signal-based input() but still declares
items with the @ContentChildren decorator. Convert to the signal-based
contentChildren() query for consistency.
2026-04-28 12:03:09 -07:00
Matthieu Riegler 444b024d49 feat(core): Add a injectAsync helper function
The commit introduces a new function to assist users who want to lazy load services and use the DI system to create them.

Example:

```ts
import {injectAsync} from 'angular/core';

class MyCmp {
  someSvc = injectAsync(() => import('..'));

  async onClick() {
    (await this.someSvc()).handleClick();
  }
}
 ```
2026-04-28 12:01:27 -07:00
Alon Mishne 0c56679049 build: lock file maintenance
Updated the pnpm-lock.yaml file to ensure all dependencies are up to date and consistent.
2026-04-28 11:55:09 -07:00
hawkgs 6abdef4f4f docs: add information about zone.js Vitest patch in the Vitest migration guide
Update the Karma to Vitest migration guide to include information about the zone.js Vitest patch that should handle `fakeAsync`.

Related to #68395.
2026-04-28 10:32:49 -07:00
Joey Perrott e4f9781f28 build(dev-infra): update dev-infra actions to latest commit
Updates all GitHub Actions that use actions from the angular/dev-infra repository to the latest commit SHA 442c2fcbf06a321b5196b4c5fc70e78a49242958.
2026-04-28 10:32:20 -07:00
Kristiyan Kostadinov 72be5be9c1 refactor(compiler-cli): remove checkTwoWayBoundEvents flag
Removes the `checkTwoWayBoundEvents` flag since the code it generates is quite breaking and we never got the chance to enable it. Also it caused our tests to misrepresent how the compiler behaves for actual users.
2026-04-28 10:31:42 -07:00
Kam 273ff07469 docs: use inject() in @Self example in hierarchical DI guide
The surrounding @SkipSelf and @Host examples already use inject(),
and the section intro recommends it. Align the @Self example to match.
2026-04-28 10:30:57 -07:00
Herdiyan IT Dev f219e65841 refactor(dev-infra): use shell: false and quote args in benchmark-compare workflow
Currently, the exec() utility uses childProcess.spawn() with shell: true. This commit changes the spawn option to shell: false to prevent OS command injection vulnerabilities and quotes the benchmark target in the github action.
2026-04-28 10:29:24 -07:00
Angular Robot 32d768f69c build: lock file maintenance
See associated pull request for more information.
2026-04-28 10:25:45 -07:00
Angular Robot 52bcec1ae4 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-04-28 10:19:56 -07:00
Alan Agius 1bfdae91aa docs: document NG_TRUST_PROXY_HEADERS environment variable for AngularNodeAppEngine
See: https://github.com/angular/angular-cli/pull/33056 for more info.
2026-04-28 10:11:12 -07:00
Simon c8aad6acc6 docs: remove duplicated text 2026-04-27 17:10:19 -07:00
Simon 38c352766a docs: remove spaces to correct the indentation 2026-04-27 17:09:45 -07:00
Kristiyan Kostadinov 6bd1721662 fix(compiler): let declaration span not including end character
Fixes that the span for `@let` declarations didn't include the end token.
2026-04-27 17:09:14 -07:00
Alan Agius 2a6b6fafb0 fix(platform-server): ensure origin has a trailing slash when parsing url
The origin did not have a trailing slash, which caused parsing issues for relative URLs.

Fixes #68322
2026-04-27 17:08:36 -07:00
aparziale 982e3cce52 docs: Fix typo in doc
Fix typo in documentation. Changed "create workspace" to "create a workspace"

Fixed #68375
2026-04-27 17:08:02 -07:00
Sonu Kapoor 3583c01bf9 fix(core): guard against non-object events and avoid listener wrapper identity mismatch
Two issues caused browser test failures after the event replay fix:

1. `markEventHandledForElement` used the event object as a WeakMap key, but
   `DebugElement.triggerEventHandler` can pass null or primitive values as the
   event argument. Added an early return for non-object values.

2. Registering a separate `domListener` closure with `renderer.listen` instead of
   `wrappedListener` caused `DebugElement.triggerEventHandler` to invoke the
   handler twice: once via `this.listeners` (which holds `wrappedListener`) and
   once via Zone.js's `eventListeners` (which holds the unwrapped `domListener`).
   The existing dedup logic in `triggerEventHandler` checks if the unwrapped
   Zone.js listener is already in `invokedListeners`, but with two different
   function objects that check always fails.

   Replaced the `domListener` wrapper with a property (`__ngNativeEl__`) stored
   directly on `wrappedListener`. `wrapListenerIn_markDirtyAndPreventDefault` reads
   this property and calls `markEventHandledForElement` when the listener fires,
   while `renderer.listen` receives the same `wrappedListener` function that
   Angular stores in `lCleanup`, preserving the dedup invariant.
2026-04-27 17:07:36 -07:00
Sonu Kapoor d5fd51e956 fix(core): prevent event replay double-invocation when element hydrates before app stability
When `withEventReplay()` is enabled and a component hydrates before the
application becomes stable (e.g. while a pending HTTP request is in
flight), a user interaction on the hydrated element triggers both the
real DOM listener registered by Angular and the jsaction replay path.
This causes the event handler to be invoked twice.

The root cause is that `listenToDomEvent` registers the same
`wrappedListener` both as a stashed jsaction handler (via
`stashEventListenerImpl`) and as a native DOM listener (via
`renderer.listen`). When the user interacts after hydration but before
app stability, jsaction queues the event because no dispatcher is
registered yet. Once the app stabilises and `initEventReplay` runs,
jsaction replays the queued event through `invokeListeners`, which
calls the stashed handler a second time.

The fix tracks dispatched `(event, element)` pairs in a
`WeakMap<Event, WeakSet<Element>>`. The native DOM listener wrapper
records each pair via `markEventHandledForElement`, and `invokeListeners`
skips replay for any pair already present. Keying by element (rather
than event alone) preserves incremental hydration behaviour, where
jsaction legitimately replays the same event on a different element
(the deferred block content) from the one that originally triggered
hydration.

Fixes #67328
2026-04-27 17:07:36 -07:00
Kam 67a5f00cd8 docs: document moduleResolution bundler change in v20 update guide
The v20 update guide doesn't flag that `ng update` switches
`moduleResolution` to `'bundler'`. Add a checklist item so manual
upgrades don't miss it.
2026-04-27 17:06:35 -07:00
Matthieu Riegler 4ad3a1fe37 refactor(core): Don't throw when there are not async metadata
In the context of AOT tests, component with defer blocks no longer throw on instanciation if the component is not overridden (with `overrideComponent`)

Prior to this change, all components with a `@defer` block would throw if `compileComponents` was not invoked.

In none-JIT apps, this change makes `compileComponents()` uneccesary.
2026-04-27 17:04:09 -07:00
Andrew Scott f17f32c351 docs(router): Fix method name for retrieving stored handles
method name was documented incorrectly. this fixes the name
2026-04-27 17:03:21 -07:00
aparziale ded5a0ed62 docs: Align Router API docs with inject based DI
Updates Router documentation examples to reflect modern inject based dependency injection instead of constructor injection.

Fixed #68378
2026-04-27 17:02:28 -07:00
SkyZeroZx d2c7b4e111 docs(docs-infra): Validate case-sensitive API symbol links in @link
Adds build-time validation for case-sensitive API symbols in `@link`. Avoid broken links
2026-04-27 17:01:40 -07:00
SkyZeroZx 70c011e879 refactor(compiler): Removes unused compiler utility functions
Remove helper functions and constants across the compiler, as they are no longer required by current logic.
2026-04-27 17:00:44 -07:00
Andrew Scott 357cb15208 refactor: use stronger language for adev writing guide
use stronger language to improve skill usage hits for adev writing.
2026-04-27 15:29:04 -07:00
Angular Robot da94272eed build: update cross-repo angular dependencies
See associated pull request for more information.
2026-04-27 15:26:58 -07:00
Angular Robot 08930e60bb docs: update cross-repo adev docs
Updated Angular adev cross repo docs files.
2026-04-24 15:58:24 -07:00
Angular Robot ac9babec96 docs: update cross-repo adev docs
Updated Angular adev cross repo docs files.
2026-04-24 13:31:56 -07:00