Commit graph

36863 commits

Author SHA1 Message Date
Alan Agius
99db2e9065 ci: add pnpm and typescript exclusions to a Renovate package rule.
This will be handled in dev-infra preset, see: https://github.com/angular/dev-infra/pull/3340
2026-01-09 10:41:54 -08:00
Kristiyan Kostadinov
7b5625e72a refactor(compiler): isolate arrow function processing
Isolates the logic that fixes references to arrow function parameters so that we don't have do pass extra parameters for every `convertAst` call.
2026-01-09 10:35:37 -08:00
Kristiyan Kostadinov
4cf1a92288 refactor(compiler): rework arrow function storage
Reworks how we store arrow functions in the following ways:
1. Rather than the `storeCallback` and `getCallback` instructions, we generate a single `arrowFunction` instruction.
2. The `arrowFunction` instruction uses a factory to create a new instance of the function when a function is read for the first time.
3. We now keep arrow functions in listeners in line so that they have access to `$event`.
2026-01-09 10:35:37 -08:00
Kristiyan Kostadinov
d9923b72a2 feat(core): support arrow functions in expressions
Adds support for using arrow functions in Angular expressions. They generally behave like JS arrow functions with the same access as other Angular expressions, but with the following limitations:
* We only support arrow functions with implicit returns, e.g. `(a) => a + 1` is allowed while `(a) => { return a + 1 }` is not.
* Pipes can't be used inside arrow functions, but they can be passed through to pipes.

To avoid recreating the functions in each change detection, the compiler applies a couple of optimizations:
* If an arrow function only references its own parameters, it is extracted into a top-level constant that is passed around to the different usage sites.
* If an arrow function has references to the template context, we store it on the current view and read the stored value later on.

Fixes #14129.
2026-01-09 10:35:37 -08:00
Kristiyan Kostadinov
3242a61bae fix(compiler): variable counter visiting some expressions twice
The `countVariables` phase visits all ops in the list and all nested expressions in order to count how many variables are used. Currently it does so by going through `unit.ops()` and then calling `visitExpressionsInOp` on each op.

This leads to expressions in ops that have nested ops (e.g. `ListenerOp`) to be visited twice, because `unit.ops()` descends into child ops and then `visitExpressionsInOp` does the same. It hasn't been a problem so far, because the only expressions that can have vars in host bindings are pure functions and they aren't generated for listeners, but it will become a problem for arrow functions since they can be used in listeners.

These changes resolve the issue by iterating over the `unit.create` and `unit.update` instead.
2026-01-09 10:35:37 -08:00
Kristiyan Kostadinov
17733b70a3 refactor(core): add instructions for callback storage and retrieval
Adds the `ɵɵstoreCallback` instruction that allows for a callback to be stored for later usage, as well as `ɵɵgetCallback` which can be used to retrieve it.
2026-01-09 10:35:37 -08:00
Kristiyan Kostadinov
87a422358b refactor(compiler-cli): template type checking support for arrow functions
Updates the template type checker to support arrow functions. The main challenge was getting the current infrastructure not to rewrite references to arrow function parameters.
2026-01-09 10:35:37 -08:00
Kristiyan Kostadinov
f05d08f432 refactor(compiler): add arrow function parsing
Updates the expression parser to handle arrow functions. Since arrow functions share syntax with other AST nodes, we have to detect them by looking ahead and then potentially jumping backwards depending on what we see.
2026-01-09 10:35:37 -08:00
Kristiyan Kostadinov
ab536f8f32 refactor(compiler): add AST nodes for arrow functions
Expands the expression AST to include arrow functions.
2026-01-09 10:35:37 -08:00
Kristiyan Kostadinov
d01e54dea4 refactor(compiler): tokenize =>
Adds some logic to tokenize the `=>` character combination in the lexer.
2026-01-09 10:35:37 -08:00
Andrew Scott
da364d2635 refactor(router): Add support for precommitHandler in Navigation integration
The `precommitHandler` of the Navigation API unlocks some of the truly
powerful features for Routers like Angular's which defer the URL
updates. Without the `precommitHandler`, we cannot initiate a navigation
until we are ready to commit the URL because it causes the URL to update
immediately.

With `precommitHandler` support, we are able to create a `NavigateEvent`
_immediately_ on navigation, which allows the browser to show that a
navigation is happening with a loading indicator. Site visitors will
also have the ability to cancel the navigation with the "stop" button.
When we are ready to commit the URL, the precommitHandler supports a
"redirect" function that we can use to first redirect the navigation to
a new location immediately before committing it.

The commit operation is not synchronous because the API waits for all
precommitHandlers to resolve. This commit adds a small bit of handling
to account for this so that the Router's transition does not advance
to the next stage until the URL has been committed.
2026-01-09 10:31:26 -08:00
fisker
4fb24cadee refactor(compiler): switch Binary.isAssignmentOperation to type guard function
Improve `Binary.isAssignmentOperation` types
2026-01-09 09:59:29 -08:00
Angular Robot
ac865b51f7 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-01-09 09:55:40 -08:00
SkyZeroZx
94b707957a docs(docs-infra): avoid persistent AbortSignal listener in wait debounce in search
Cleans up the abort listener once the timeout resolves to prevent it from
remaining attached longer than necessary.
2026-01-09 09:38:07 -08:00
Yahya-Almubarak
e3b3290998 docs: replace UnambiguousRoleValidator in asyc-valdotors part form-validation.md
The async validators part of document uses uniqueRoleValidator and not UnambiguousRoleValidator.
2026-01-09 09:26:18 -08:00
Devin Chasanoff
09234753e1 docs: add ai tutor signal forms docs 2026-01-09 09:25:38 -08:00
Angular Robot
e6a8bb81f9 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-01-09 09:05:18 -08:00
kirjs
7d985ce08e docs(forms): Clarify returning errors from submit functions
Update outdate comment, and add a section to the docs
2026-01-09 08:47:42 -08:00
fisker
a7e470a1b3 refactor(compiler): tighten Unary.operator type
Improve `Unary.operator` type
2026-01-09 08:47:01 -08:00
fisker
4d19408e9b refactor: _ParseAST.isAssignmentOperator to type guard
Update `_ParseAST.isAssignmentOperator` to type guard
2026-01-09 08:45:35 -08:00
fisker
07a08ab9f8 refactor(compiler): tighten Binary.operation type
Improve `Binary.operation` types
2026-01-09 08:45:35 -08:00
fisker
04ba09a8d9 feat(compiler): support AstVisitor.visitEmptyExpr()
Add support for `AstVisitor.visitEmptyExpr()`
2026-01-09 08:45:12 -08:00
hawkgs
e66aeac8d0 refactor(devtools): style the profiler dialogs to match the current design
Decrease the font size and tone down the paddings and margins. Use `ng-button` instead of `mat-button`.
2026-01-09 08:23:18 -08:00
hawkgs
bea5840864 refactor(devtools): add secondary type button
Add a secondary style/type button to `ng-button`.
2026-01-09 08:23:18 -08:00
SkyZeroZx
3a65814f53 docs(docs-infra): improve label fallback logic in search results
Improves label fallback in search results by providing a fallback to the top-level category when a more specific label is missing.
2026-01-09 07:58:33 -08:00
SkyZeroZx
0d35088b56 docs: add docs support for spread and rest operators in expression syntax 2026-01-09 07:58:07 -08:00
Angular Robot
3ccd5a4354 build: update cross-repo angular dependencies to v21.1.0-next.4
See associated pull request for more information.
2026-01-09 07:49:52 -08:00
Alon Mishne
c963f35d2c docs: Updated MCP docs to include latest experimental tools and recent renames 2026-01-09 07:48:22 -08:00
Matthieu Riegler
80a7419a16 Revert "docs: remove incorrectly listed operators in "Supported operators" table (Expression Syntax Guide) (#62092)"
This reverts commit ea71a1e8cd.
2026-01-09 07:47:49 -08:00
Andrew Scott
49295778bc refactor(core): Use the provided Document value rather than global in FakeNavigation
This commit ensures the Document used by `FakeNavigation` is the one
passed in the constructor rather than the global `document`, which may
be different.
2026-01-08 13:28:18 -08:00
Andrew Scott
473dd3e1cb fix(compiler-cli): attach source spans to object literal keys in TCB
Previously, object literal keys in the TCB did not have source spans attached. This made it difficult for the Language Service to distinguish between keys and values, leading to incorrect completion contexts and diagnostic locations.

This commit ensures that source spans are properly attached to the keys in the TCB.
2026-01-08 13:27:08 -08:00
Angular Robot
00905c1c03 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-01-08 13:26:26 -08:00
Jessica Janiuk
9529362617 docs: release notes for the v21.1.0-rc.0 release 2026-01-08 12:52:40 -08:00
Jessica Janiuk
e005eb4e66 release: bump the next branch to v21.2.0-next.0 2026-01-08 12:52:40 -08:00
Jessica Janiuk
3b8c4fc136 docs: release notes for the v21.0.8 release 2026-01-08 12:44:14 -08:00
Jessica Janiuk
a2b9429992 Revert "feat(router): add trailingSlash config option"
This reverts commit 12fccc5e99.
2026-01-08 12:20:03 -08:00
Andrew Scott
86dc1283e8 fix(core): handle cancelled traversals in fake navigation
Update fake navigation implementation to correctly handle traversals that are cancelled (e.g. by a precommit handler).
Ensure prospective index is calculated correctly so that subsequent traversals target the correct entry.
Add regression test for cancelled traversals.
2026-01-08 11:27:37 -08:00
omar-almasry11
ad49d489ae fix(docs-infra): improve dark mode button hover contrast for WCAG compliance
The .docs-primary-btn hover state in dark mode had a contrast ratio of 2.18:1,
failing WCAG 2.1 SC 1.4.3. This change reuses the existing
--hot-pink-to-electric-violet-radial-gradient to achieve 4.5:1+ contrast.
2026-01-08 11:21:23 -08:00
Angular Robot
50ded69afb build: update cross-repo angular dependencies
See associated pull request for more information.
2026-01-08 11:17:03 -08:00
zakaria-bali
bd5997cfeb docs(forms): make onSubmit method async for form submission
Change onSubmit method to be asynchronous since we are using await inside it
2026-01-08 10:03:23 -08:00
lyutails
8fad6155b2 docs: fix typo in effect.md 2026-01-08 10:02:51 -08:00
aparziale
71149ef57a docs(docs-infra): Fix toggle button in dark mode
Fix visibility toggle button in dark mode

Fix #66049
2026-01-08 09:07:56 -08:00
Angular Robot
adabdcd173 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-01-08 08:43:27 -08:00
Angular Robot
7d3cf91b1e build: update all non-major dependencies
See associated pull request for more information.
2026-01-08 08:41:30 -08:00
Shuaib Hasan Akib
f727f8e655 docs: fix broken anchor link for Angular versioning section
Updates the release documentation link to point to the correct `#angular-versioning` anchor so readers are directed to the intended
2026-01-08 08:35:30 -08:00
Matthieu Riegler
8bc688b56f docs: add release schedule 2026-01-08 08:34:47 -08:00
Andrew Scott
12fccc5e99
feat(router): add trailingSlash config option
This commit introduces a highly requested `trailingSlash` configuration option to the Angular Router, allowing developers to control how trailing slashes are handled in their applications. The options are:
- 'always': Enforces a trailing slash on all URLs.
- 'never': Removes trailing slashes from all URLs (default).
- 'preserve': Respects the presence or absence of a trailing slash as defined in the UrlTree.
2026-01-08 08:26:37 -08:00
Matthieu Riegler
d100e691d8 refactor(core): extend tests for empty cases.
follow-up of #66372 to extend a bit our runtime test coverage for empty cases
2026-01-08 08:24:53 -08:00
Andrew Scott
7003e8d241 feat(router): Publish Router's integration with platform Navigation API as experimental
This publishes the work that was done to integrate with the Navigation
API as an experimental router feature. Browser support is limited and in
active development. There are also known bugs in the browser implementations
and only Chromium browsers supported deferred URL updates with the
`precommitHandler`. Relates to #53321, which I would likely not mark as
completed until this is at least in dev preview, which likely won't
happen until it is widely available and potentially delayed until
`precommitHandler` is widely available as well.

The final form of this api might not even be a "router feature" in the end, but instead be
something similar to what other frameworks have to provide different
platform integrations (e.g. `provideNavigationRouter`). That would
support omitting the history-based integration from the bundle when only
the navigation integration is used. Alternatively, the current
`provideRouter` could require one of `withHistory` or `withPlatformNavigation`.
2026-01-07 16:16:06 -08:00
Matthieu Riegler
0ad3adc7c6 fix(compiler): Support empty cases
Before this commit empty @cases ended up being interpreted as consecutive cases.
2026-01-07 15:47:59 -08:00