PR #71799 cherry-picked tests using `signal` and `await fixture.whenStable()` onto `22.2.x`, where `signal` was not yet imported and `describe('attribute binding')` still configures `provideZoneChangeDetection()`. Import `signal` and use `fixture.detectChanges()` to match the rest of the suite on `22.2.x`.
With `outputMode: "static"` and prerendering, the CLI writes the host page
to `index.csr.html` and `index.html` is the prerendered home page. Pointing
the fallback at `index.html` serves the home page's HTML for every route
that wasn't prerendered. Add a note to the fallback section.
(cherry picked from commit 939171c6f9)
The guide and the RouterOutlet API docs both say the outlet name cannot
be set or changed dynamically. The name has been an input since #46569,
and ngOnChanges moves the outlet to the new name when it changes.
When the value changes, the outlet destroys its current component and
renders the route for the new name, if one matches. Describe that
instead.
(cherry picked from commit 2af465b71f)
Mention running the mdc-migration schematic for apps still using legacy Material components, link the v17 MDC migration guide, and point the v15 step at the version-pinned guide since the rc link now redirects to the guides list.
(cherry picked from commit ee7f788e4e)
The workaround introduced in #71095 converted `null` and `undefined` to `''` in `unwrapImgVideoSrcValue()`. While this coercion is needed for DOM property bindings (`[src]`) to prevent browsers from stringifying `undefined` to `"undefined"`, it inadvertently affected attribute bindings (`[attr.src]`).
In the attribute binding path, coercing `null`/`undefined` to `''` causes `<img [attr.src]="null">` to set `src=""` on the element rather than removing the attribute via `removeAttribute()`. In standard HTML, `<img src="">` causes the browser to trigger an `(error)` event on the element, breaking patterns relying on omitting the `src` attribute until a URL is available.
This commit updates `unwrapImgVideoSrcValue` to accept an `isAttribute` flag and only coerces `null`/`undefined` to `''` for property bindings. Attribute bindings continue to unwrap bypassed safe values while preserving `null`/`undefined` so that `setElementAttribute()` removes the attribute.
(cherry picked from commit d0bef2c605)
The guide said Angular ignores all attribute bindings and event listeners
on ng-container. The compiler now rejects attribute bindings on it, and a
directive host attribute binding fails at runtime. Property bindings only
work for directive inputs, and unknown ones are reported as errors.
Class bindings, style bindings, DOM event listeners and static attributes
are still ignored, so describe each case.
(cherry picked from commit b223af6b84)
Remove the unused private _cachedHead field from Meta. The service
never reads or writes this field and accesses the document head directly.
(cherry picked from commit 57c7a8d1a0)
Create field injectors only when managed metadata needs an injection
context, and destroy only injectors that have already been created.
Plain metadata and built-in synchronous rules otherwise allocate an
unused injector per field, including during removal.
Preserve eager managed metadata creation, the shared field injection
context, and teardown of asynchronous validators.
Fixes#71623
(cherry picked from commit 67e5069327)
The API reference filter writes its value to the URL on each change. With
the Navigation API integration, each of these navigations ends with the
browser moving focus to the body, so typing `signal` in the filter leaves
`s` and the other keys go to the page.
Pass `focusReset: 'manual'` next to `scroll: 'manual'`, so focus stays in
the filter field. The option isn't in the router's public types on this
branch, hence the cast.
With the Navigation API integration, the browser resets focus after each
navigation, so a field that writes its value to the URL as the user types
loses focus after the first key.
The `focusReset` option that fixes this is new public API on main
(#71595), so it can't come to the patch branch. Read `focusReset` from
the navigation extras without adding it to `NavigationBehaviorOptions`,
so angular.dev can pass it in the API reference filter.
`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.
(cherry picked from commit afbe39765c)
Renderer2 uses the same DOM renderer on the server as in the browser and
operates on the server's Domino document, so its DOM manipulation works
during server-side rendering and pre-rendering. Describe the real limit,
which is the missing browser-only APIs in the server DOM.
(cherry picked from commit 73661917e1)
Run Route.loadComponent and Route.loadChildren in the Router's root environment injector rather than the route injector in google3 so that loads can happen in parallel rather than being blocked on lazy providers from loadConfig (https://github.com/angular/angular/pull/70860).
Gated behind `g3-only` / `3p-only` markers so 3p behavior remains unchanged until v23.
(cherry picked from commit cfad3f5854)
Custom controls implementing `FormValueControl` bound via `[formControl]` or `formControlName` currently bypass `setUpControlValueAccessor`. In `NgControl.ngControlCreate`, incoming values from the custom control model were applied directly to the `FormControl` without checking `control.updateOn`.
This update respects `control.updateOn` by buffering pending values and dirty state when `updateOn` is set to `'blur'` or `'submit'`. Value and validity are committed on `touch` output emissions for `'blur'`, and on form submission for `'submit'`. Programmatic resets also synchronize the reset value to the custom control when pending changes are cleared.
Programmatic `setValue` and `reset` calls now also update `[(ngModel)]` for custom controls, as they do for CVAs.
(cherry picked from commit 401b4f2011)
escapeCommentText matched each disallowed marker as a whole, so a marker that overlaps an already matched one was skipped by the scanner and left unescaped. Match the delimiter together with its context instead, which keeps the matched language identical for the existing cases.
(cherry picked from commit f3c77f1e2b)
Changing state in the content and view hooks does not always throw
ExpressionChangedAfterItHasBeenCheckedError. Content hooks run before the
component's own template is checked, so only state an ancestor's template
has rendered is affected. Signals schedule another pass instead of
throwing, and an OnPush view is skipped by the default check.
(cherry picked from commit 12eb4d0329)
New applications use `@angular/build`, not `@angular-devkit/build-angular`. Scope the `builderMode` note to the devkit Karma builder, since the `@angular/build` test builders always use the application builder. Note that `module: preserve`, the default for new projects, supports import attributes, and that `ng update` offers the migration on each major update, not only v18.
(cherry picked from commit 12b0e89e7a)
Several descriptions no longer match the current builders:
- `serve` and `test` use their own options and point at a build
through `buildTarget`; they don't take the `ng build` options.
- `e2e` and `lint` aren't generated by `ng new`.
- The unit test note about adding styles and scripts to the `test`
target only applies to Karma. With `@angular/build:unit-test`, global
scripts need `setupFiles`.
- `security` was missing `allowedHosts` and the `autoCsp` object form,
and `index` was missing `false` and `preloadInitial`.
(cherry picked from commit 4c7783fb23)
Expose `required` from `CompatFieldNode` by deriving a signal from the wrapped control's `hasValidator(Validators.required)` state, using the existing control-status signal helper so validator updates and control swaps are observed.
Fixes#68905.
(cherry picked from commit 97bde8aa6c)
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'`.
(cherry picked from commit 9e99093bfe)
The web worker, service worker and app shell guides still showed `app.component.*` file names and the old root template text. Use the current names (`app.ts`, `app.html`, `app-shell.ts`), the current root template text, and list the files the generated `ngsw-config.json`
actually caches.
(cherry picked from commit cd9d0aea3f)