1749 Commits
Author SHA1 Message Date
Doug Parker ec0f0583c3 refactor(core): update WebMCP tool declaration APIs to include outputSchema
Update `ToolDescriptor`, `declareExperimentalWebMcpTool`, and `provideExperimentalWebMcpTools` to explicitly support the `outputSchema` property. This allows tools to specify their expected return format using standard JSON Schema syntax, ensuring that AI agents know exactly how to interpret the tool execution results.
2026-11-20 08:35:37 -08:00
arturovt fee6dbf526 fix(core): throw coded error when @for collection is not iterable
Consider the following example:

```ts
@Component({
  template: '@for (item of items; track item) {{{ item }}}',
})
class App {
  items = {0: 'a', 1: 'b'};
}
```

Prior to this commit, `reconcile()` treated every non-nullish value that is
not an array as an iterable and called `Symbol.iterator` on it without a
check. A plain object therefore failed with a raw `TypeError`:

```
TypeError: t[Symbol.iterator] is not a function
```

That error carries no code, does not mention `@for`, and does not say which
template produced it. In a production build the stack is minified, so error
reporting shows nothing actionable. The same value through `*ngFor` reports
NG02200, which names the problem and suggests the keyvalue pipe, so `@for`
was harder to debug than the API it replaces.

With this commit the same value throws NG0957. Only the message text is
behind `ngDevMode`; the check itself is not, because production is where the
raw error is unreadable today. The array fast path is untouched, and `null`
and `undefined` keep rendering nothing.

The code is negative, which is how this package marks codes that have a
guide on angular.dev, so the fix ships with one.
2026-11-19 15:39:55 -08:00
Kristiyan Kostadinov f41e1d8269 fix(compiler-cli): remove unused compiler option
The `allowEmptyCodegenFiles` compiler option wasn't used and has been cleaned up internally. These changes remove the last references to it.
2026-11-16 16:17:21 -08:00
arturovt 2a450cbfaa fix(core): throw NG0512 instead of TypeError when hydration text node is missing
Given this template:

```html
<main>
  <span>{{ value }}</span>
</main>
```

During hydration, Angular looks for the text node that the server rendered
inside the `<span>`. If the HTML from the server was changed and this text
node is missing, dev mode throws a clear NG0500 error. But this check only
runs in dev mode.

Prior to this fix, production continued with the missing text node and failed
on the first update of that binding with a raw error that doesn't say what
went wrong:

```
TypeError: Cannot set properties of null (setting 'nodeValue')
```

With this fix, production throws NG0512 during hydration instead.

Note that static text behaves differently. Nothing ever updates it, so it
hydrated without an error before this fix and left a gap in the DOM. It now
throws as well.
2026-11-16 14:12:24 -08:00
aparzialeandMatthieu Riegler e4f67442bb feat(compiler): report unknown property bindings on explicit ng-template elements
Previously, property bindings on `<ng-template>` that were not claimed
by a matched directive were silently ignored by the type checker. This
was inconsistent with how bindings on regular elements are handled.

This check is added behind a temporary compiler flag `checkTypeOfNgTemplateBindings` which will be removed
in the next breaking change window.

When the flag is enabled, the type checker will report an error for any property binding on an `<ng-template>` that is not matched by a directive.

Fixes #69322

Co-authored-by: Matthieu Riegler <[email protected]>
2026-11-11 15:41:43 -08:00
Matthieu Riegler effbe56432 feat(http): add HttpClient.query() method for HTTP QUERY requests
This commit adds the `HttpClient.query()` method to `HttpClient` in order to support HTTP QUERY method as defined in RFC 10008.

fixes #70856
2026-11-11 14:59:29 -08:00
rkandleonsenft f9cf82642c fix(forms): apply validator directives to custom form controls
Custom control (`value` or `checked` model, no ControlValueAccessor) bound with NgModel,
FormControlDirective or FormControlName is set up by setupCustomControl, which doesnt call
setUpValidators. Validator directives on element (required, minlength, any directive providing
NG_VALIDATORS) and NG_VALIDATORS provided by control itself never reach FormControl, so control
stays valid and form submits. ControlValueAccessor path merges them, and cleanUpControl already
removes them when FormControlDirective or FormControlName lets go of control

Call setUpValidators from setupCustomControl. Applying validators needs few more changes:

- FormControlName: ɵngControlUpdate runs before ngOnChanges of element, so setting control up
  there would run control's own NG_VALIDATORS before its ngOnInit, and first ngOnChanges of each
  validator directive would emit valueChanges and statusChanges during first change detection.
  ɵngControlUpdate now only resolves control and ngOnChanges sets it up, same as for
  ControlValueAccessor
- required: with FormControlDirective and FormControlName, NgControl also wrote `required` into
  RequiredValidator on same element. That cleared static `required`, and Validators.required
  turned into directive validator that outlived removeValidators(). setInputOnDirectives now
  passes directive to writePredicate and NgControl skips RequiredValidator. Custom control gets
  `required` from enabled RequiredValidator or Validators.required under all three directives
- errors: status inputs are read through untracked getters and `errors` was plain field, so
  re-validation later in same pass (validator directive's ngOnChanges) left `invalid` and `errors`
  stale, and markForCheck during that refresh doesnt re-run view. `errors` is backed by signal now
  like `status`, and ngControlUpdate reads both, so errors-only change is bound in same pass, with
  `emitEvent: false` too
- _enabled on validator directives is backed by signal too, so change from their ngOnChanges
  reaches custom control in same change detection

Fixes #70721

Co-authored-by: leonsenft <[email protected]>
2026-11-11 14:59:21 -08:00
Alex Rickabaugh ae9c706d14 refactor(compiler): remove selectorless prototype
Removes the experimental "selectorless" template syntax (`<MyComp>` / `@Dir(...)`)
which was never shipped. This deletes:

- compiler: lexer/parser support for component and directive tokens, the
  html `Component`/`Directive` nodes and the R3 `Component`/`Directive`
  (`TmplAstComponent`/`TmplAstDirective`) nodes together with their visitor
  methods and the `directives` field on elements/templates, the
  `selectorlessEnabled`/`enableSelectorless` parse options, direct pipe
  references (`BindingPipeType`), selectorless reference validation, the
  selectorless paths in the binder (`referencedDirectiveExists`),
  type-check ops, indexer, i18n and template pipeline.
- compiler-cli: the `_enableSelectorless` option, selectorless component
  analysis and `SelectorlessScope`, deferred selectorless dependencies,
  selectorless template symbols, out-of-band diagnostics and the related
  error codes (2024, 2025, 2026, 8018), the linker option, and the
  preprocessor/ng-analyze selectorless analysis.
- language-service: selectorless definitions, quick info, references and
  rename.
- the selectorless runtime and compiler tests.

`SelectorlessMatcher` is kept since it is used to match foreign components
(`foreignImports`) by tag name.
2026-11-11 09:10:56 -08:00
Matthieu Riegler 262417f155 feat(router): introduce route error boundaries and redirect handling
Introduces error boundary support in the Angular Router, allowing individual routes to declare an `errorComponent` and applications to configure global fallback defaults via `withErrorBoundaries`.
2026-11-10 13:20:49 -08:00
aparziale 3296939422 fix(core): improve error message for unparsable ICU expressions in translations
Previously, when a translation contained an ICU expression that could not be
parsed at runtime, the error was a plain `Unable to parse ICU expression in
"..." message.` without explaining the most common causes or carrying an
error code.

The error is now a `RuntimeError` with the dedicated code NG0702
(`UNPARSABLE_ICU_EXPRESSION`). The message explains that the translation must
contain a valid ICU expression and that ICU expressions can only be used in a
translation when the original message contains one as well. The detailed
message is guarded by `ngDevMode`, so it is tree-shaken away from production
bundles where only the error code remains, while the error itself is still
thrown in production because translations vary by locale and may not be
exercised during development.

Additionally, the `$localize` docs now call out that ICU expressions are not
supported by the tagged-string API.

Fixes #48217
2026-11-10 11:12:35 -08:00
arturovt 65ef5cc865 docs: explain hydration errors from CDNs and browser extensions
Some CDN features and browser extensions change the HTML from the
server before hydration starts. These errors often happen only in
production or only for some users, so they are hard to find.

Prior to this commit, the docs didn't explain these causes and `NG0509`
had no error page.

With this change, the hydration guide explains these causes and their
fixes, and `NG0509` has an error page.

The `NG0509` code is now negative, like other codes that have an error
page. This changes the public API golden for `RuntimeErrorCode`.
2026-11-09 14:19:24 -08:00
Matthieu Riegler 12278e5f67 fix(forms): preserve options passed to SignalFormControl
Ensure that options passed to SignalFormControl (either as the second argument or as the third argument with a schema or undefined) are preserved and correctly forwarded to compatForm and form().

Previously, normalizeFormArgs relied on args.length === 3, causing options passed as the second argument to be misidentified as a schema function. Furthermore, SignalFormControl only forwarded {injector} to compatForm, discarding options such as name.
2026-11-09 14:18:58 -08:00
Roman Khegay 36f3bfab92 docs: add error guide for NG8022
Document the unsupported form field binding error and mark its code as negative so the diagnostic links to the guide
2026-11-09 10:51:55 -08:00
Shuaib Hasan Akib afbe39765c fix(core): add debugName option to rxResource
`resource()` and `httpResource()` accept a `debugName` to identify their
signals in Angular DevTools, but `RxResourceOptions` didn't, so passing
one to `rxResource()` was a type error. The options are already
forwarded to `resource()`, so only the type was missing.
2026-11-03 16:26:27 -08:00
Angular Robot 92c7e870ca build: update cross-repo angular dependencies
See associated pull request for more information.
2026-11-02 17:05:22 -08:00
Matthieu Riegler 9e99093bfe fix(forms): reject unsupported updateOn in SignalFormControl
Signal forms are model-driven and do not support pending or uncommitted
values. As a result, non-default `updateOn` options (`blur`, `submit`)
cannot be supported.

This commit adds a dev-mode check in `SignalFormControl` to throw an error
when:
1. An unsupported `updateOn` option is passed directly in options to the
   `SignalFormControl` constructor.
2. A non-default `updateOn` option is inherited from a parent `FormGroup`
   or `FormArray` via `setParent()`.

Additionally, `SignalFormControl` explicitly overrides `get updateOn()`
to return `'change'`.
2026-10-28 16:45:56 -07:00
brysonbw 63e21a76de feat(router): support direct component param
Allows skipping undefined extras arg.
2026-10-28 16:43:37 -07:00
brysonbw e7f04bd20c feat(router): add navigate method to RouterTestingHarness
Mirrors `Router.navigate` so tests can pass `queryParams`, `fragment` and other
`NavigationExtras` without an extra navigation.
2026-10-28 16:43:37 -07:00
Georgi Serev 38afab7a24 refactor(core): use official webmcp-types
Vendor the official `webmcp-types` instead of `@mcp-b/webmcp-types`.
2026-10-28 14:58:48 -07:00
Amine 8260542ce0 feat(router): add focusReset to NavigationBehaviorOptions
With the platform navigation integration, the router passes `scroll` to
`NavigateEvent#intercept()` but not `focusReset`, so the browser moves
focus to the body after every navigation. A search field that writes its
value to a query param loses focus after the first key.

Add a `focusReset` option next to `scroll` and pass it to `intercept()`,
so a navigation can leave focus where it is. Without the option, the
browser default still applies.

Fixes #71594
2026-10-26 16:05:32 -07:00
Andrew Scott 4742af1435 feat(router): make route resources reactive and support parallel dependent loading
Makes route resources reactive via `ResourceContext.resources`
(`Signal<ResourceResult>`) to enable reactive resource inheritance and parallel
execution of dependent resources across routes.
2026-10-23 14:13:25 -07:00
Amine 34ea5922ba feat(router): add scroll input to RouterLink
`NavigationBehaviorOptions#scroll` lets a navigation opt out of the in-memory
scroller, but `RouterLink` didn't expose it. Tabs or filters driven by query
params further down a page had to give up real links and navigate by hand with
`router.navigate(..., {scroll: 'manual'})` to avoid jumping back to the top.

`RouterLink` now has a `scroll` input that is forwarded to the navigation, like
`browserUrl`, `state` or `replaceUrl` already are:

```html
<a routerLink="." [queryParams]="{tab: 'reviews'}" scroll="manual">Reviews</a>
```

Fixes #71287
2026-10-23 12:44:12 -07:00
jaybell d2f5ec92de fix(forms): annotate field context helpers with this: void
`valueOf`, `stateOf` and `fieldTreeOf` on the field context are commonly
destructured in logic functions (e.g. `({valueOf}) => valueOf(p.name)`).
Because they were declared with method syntax, `@typescript-eslint/unbound-method`
and oxlint's `typescript/unbound-method` reported a false positive for every
destructured use.

At runtime these members are already safe to destructure: `FieldNodeContext`
binds `stateOf` and `fieldTreeOf` in its constructor and defines `valueOf` as
an arrow function. Declaring `this: void` makes the public types match that
contract. This is a type-only change with no runtime behavior change.

Claude-Session: https://claude.ai/code/session_01VjkGFtQxxE6pd2BoC8wRxh
2026-10-22 14:17:33 -07:00
arturovt 63f4bd4c7e fix(forms): don't crash when formControlName has no matching control
Even tho reactive forms might be considered legacy now, this fix covers
a real production case.

Prior to this commit, a `formControlName` with no control for it in the
form group crashed in production with a raw `TypeError: Cannot read
properties of null (reading '_rawValidators')`. The error said nothing
about forms or which control was missing, so it was hard to trace back
to the template. A common way to hit it: the template and the form group
are built from the same list but with two different filters, so an item
passes the template's filter but was never given a control.

`AbstractFormDirective.addControl` read `this.form.get(dir.path)` and
passed the result into `_setupWithForm` without a null check. In dev
mode this was still caught earlier, in `setUpControlValueAccessor`
("Cannot find control with path"). In production `ngDevMode` strips that
check away, so the null control reached `setUpValidators`, which
dereferences it right away and threw the bare `TypeError`.

With this fix, `addControl` checks the control first and throws a coded
`RuntimeError` (NG01055), with a docs page on angular.dev. The check is
not gated behind `ngDevMode`, since the crash it prevents is a production
one. The message stays `ngDevMode`-only and lists the sibling controls
that exist at that path, which is usually enough to spot a name mismatch.

Fixes #71155
2026-10-20 13:36:55 -07:00
SkyZeroZx 1f1d4d1b8b feat(compiler-cli): add check for numeric CSS properties requiring units
Add check for numeric CSS properties requiring units

Fixes #61381
2026-10-20 10:21:48 -07:00
arturovt 3a0835b332 fix(core): don't crash initEventReplay when two apps share an APP_ID
Please note that this change addresses a **real** production issue
observed, rather than a speculative issue identified through
AI-assisted code analysis.

There is no open issue because most people never put two apps with the
same APP_ID on one page.

Prior to this commit, if you bootstrap 2 apps simultaneously, i.e. a
real app + a widget coming from a CDN (the code we don't have control
of, but we only configure the app name in their settings):

```text
TypeError: Cannot read properties of undefined (reading 'c')
```

With this fix, the code no longer fails with a raw type error. It warns
with code NG0511 instead. It does not crash explicitly, because that
might break whenStable().
2026-10-14 13:02:15 -07:00
Shuaib Hasan Akib 32a7603812 docs: add NG0904 error reference page for UNSAFE_VALUE_IN_RESOURCE_URL
Adds a reference page for `NG0904`, thrown when a plain string is bound to
a resource URL attribute (such as `<iframe src>`) without being marked
trusted via `bypassSecurityTrustResourceUrl`. The error code is made
negative so the error message links to the new page.

Fixes #71092
2026-10-07 09:56:18 -04:00
SkyZeroZxandAndrew Scott a1bffc29dd fix(router): fall back when serializing protocol-relative URLs
Avoid throwing when DefaultUrlSerializer encounters a UrlTree that would serialize to a protocol-relative URL. Warn in development mode and serialize the tree with a root-relative path instead while preserving query parameters and fragments.

Additionally, account for WHATWG URL normalization (e.g. dot segments and backslashes collapsing into protocol-relative paths such as `/.//` or `/..//`).

Fixes #69700
Fixes #71076

Co-authored-by: Andrew Scott <[email protected]>
2026-10-02 10:22:45 -04:00
jhjh1214 a32cd1ad7f docs: add pages for the NG8011 and NG8112 diagnostics
controlFlowPreventingContentProjection (NG8011) and unusedLetDeclaration (NG8112) can be
configured under extendedDiagnostics.checks, but neither had a details page. The NG8112 message
links to extended-diagnostics/NG8112, which currently resolves to the angular.dev home page.

Add a page for each. NG8112 goes under extended-diagnostics like the other configurable checks.
NG8011 is in the 80xx range of ErrorCode, which is for compiler errors documented under
adev/src/content/reference/errors, so its code is flipped to -8011 to match every other
documented code in that decade, which is what makes the compiler add the guide link, and its page
goes under errors instead.
2026-09-29 14:14:04 -07:00
Matthieu Riegler 91b8391b3d fix(compiler-cli): validate unknown element tags even when matched by attribute directives
Previously, the template type checker assumed that if any directive
matched an element node, the element itself did not need DOM schema
validation because it was assumed to be either a component or a custom
element tag like <router-outlet>.

However, if an unknown custom element tag (such as <tn-uploader>) is
only matched by attribute directives (e.g. [formControl]), the tag name
remains unclaimed and is missing its corresponding component import.
In this case, the compiler failed to emit a SCHEMA_INVALID_ELEMENT
diagnostic.

This commit updates the element validation condition in the type checker
to verify the element tag name against the DOM schema unless the element
matches an Angular component or a directive whose selector explicitly
matches the tag name.

By default this check will be disabled to prevent a breaking change in v22.3.
You can enable it with `strictUnknownElementWithDirectives: true`.

In v23 `strictUnknownElementWithDirectives` will be enabled by default.

Related to #46351
2026-09-29 12:31:31 -07:00