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.
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.
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.
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]>
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]>
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.
Introduces error boundary support in the Angular Router, allowing individual routes to declare an `errorComponent` and applications to configure global fallback defaults via `withErrorBoundaries`.
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
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`.
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.
`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.
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'`.
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
Makes route resources reactive via `ResourceContext.resources`
(`Signal<ResourceResult>`) to enable reactive resource inheritance and parallel
execution of dependent resources across routes.
`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
`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
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
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().
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
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#69700Fixes#71076
Co-authored-by: Andrew Scott <[email protected]>
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.
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