Commit graph

37129 commits

Author SHA1 Message Date
Suraj Yadav
2c141c04cb refactor(compiler-cli): simplify Angular decorator stripping
Removes redundant decorator-stripping branches and consolidates
the transformation flow to reduce complexity and improve readability.
2026-04-22 11:07:35 -07:00
Angular Robot
271dd4d933 docs: update cross-repo adev docs
Updated Angular adev cross repo docs files.
2026-04-22 11:04:19 -07:00
Kristiyan Kostadinov
8f3d0b9d97 feat(core): introduce @Service decorator
These changes introduce the new `@Service` decorator which is a more ergonomic alternative to `@Injectable`. The reason we're adding a new decorator is that `@Injectable` has been around since the beginning of Angular and it has a lot of baggage that adds unnecessary overhead for users that generally want to define a singleton service, available in their entire app. The key differences between `@Service` and `@Injectable` are:
1. `@Service` is `providedIn: 'root'` by default. You can opt into providing the service yourself by setting `autoProvided: false` on it.
2. `@Service` doesn't allow constructor-based injection, only the `inject` function.
3. `@Service` doesn't support the complex type signature of `@Injectable` (`useClass`, `useValue` etc.). Instead it supports a single `factory` function.

Example:

```ts
import {Service} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {AuthService} from './auth';

@Service()
export class PostService {
  private readonly httpClient = inject(HttpClient);
  private readonly authService = inject(AuthService);

  getUserPosts() {
    return this.httpClient.get('/api/posts/' + this.authService.userId);
  }
}
```
2026-04-22 11:01:01 -07:00
Rishabhdeep Singh
b395173cf2 fix(migrations): fix NgClass leaving trailing comma after removal
This fixes an issue where when removing NgClass from the imports array of a component, an extra trailing comma would be left behind if it was the last element in that component`.
2026-04-22 09:59:49 -07:00
Rishabhdeep Singh
27f021248d fix(migrations): fix NgClass leaving trailing comma after removal
This fixes an issue where when removing NgClass from the imports array of a component, an extra trailing comma would be left behind if it was the last element in that component`.
2026-04-22 09:59:49 -07:00
Angular Robot
09b9a62a25 build: lock file maintenance
See associated pull request for more information.
2026-04-21 11:52:07 -07:00
Angular Robot
28760bd050 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-04-21 10:21:43 -07:00
Joel Kesler
b24b4cb699 fix(docs): link formatting in "Animating your Application with CSS"
One of the links in `Animating your Application with CSS` page has a formatting bug for one of it's links.
2026-04-21 10:20:05 -07:00
Bhuvansh855
8ca07f171a docs: improve wording and consistency in http documentation 2026-04-21 10:17:26 -07:00
Nikhil Bachani
ac92a8aae8 docs: fix tracking expression reference in NG0955.md
Corrected the tracking expression reference from 'item.key' to 'item.value' in the explanation of duplicate keys.
2026-04-21 10:14:47 -07:00
Matthieu Riegler
fa6a3d208d docs: update builder docs
We use `@angular/build` today.
2026-04-21 09:02:31 -07:00
Matthieu Riegler
1f52ea83ab build: removing unused deps
They were unused (at least at the workspace level), we can remove them from there.
2026-04-21 09:01:15 -07:00
SkyZeroZx
6eff439546 fix(router): restore internal URL on popstate when browserUrl is used
Fixed an issue where back/forward (`popstate`) navigation attempted to match the displayed `browserUrl` instead of the internal route, which could result in `NG04002: Cannot match any routes`.

Fixes #67549
2026-04-20 16:46:25 -07:00
Kam
d27e2c24e1 docs: warn against storing secrets in environment files
Add a CRITICAL callout warning that files in `src/environments/`
ship to the client and should not hold secrets like API keys.
2026-04-20 13:29:13 -07:00
Kam
c04c0b977a docs(docs-infra): guard sandbox reset before initialization in playground
changeTemplate() was calling reset() on the sandbox before init()
completed, causing a TypeError when spawning processes on an
uninitialized WebContainer. Add isSandboxReady signal to skip
reset until the sandbox is fully initialized.
2026-04-20 13:17:17 -07:00
Kam
3293ced401 docs(docs-infra): add Angular Aria accordion playground template
Adds a single-expansion accordion playground template under
adev/src/content/tutorials/playground/5-aria-accordion demonstrating the
Angular Aria primitives. Wires @angular/aria into the editor TypingsLoader
so imports resolve in the sandbox.
2026-04-20 13:15:59 -07:00
Kam
2dc3ab596b docs(docs-infra): adjust close button spacing in mobile navigation
Use relative positioning to offset the close button from the top edge without affecting the layout of surrounding elements.
2026-04-20 13:14:34 -07:00
Matthieu Riegler
13be2961f6 ci: remove disabled side-effects integration tests
This test was disabled 5+ years ago, we probably don't need it anymore.
2026-04-20 13:13:22 -07:00
Bhuvansh855
74a7d6b8f9 docs: improve wording and consistency in forms documentation 2026-04-20 13:12:29 -07:00
Andrew Scott
9f479ae964 feat(core): Update Testability to use PendingTasks for stability indicator
Since angular@12181b9, zone stability
contributes to the PendingTasks. There is now a single source of truth for application stability
tracked in PendingTasks. This change makes protractor's whenStable compatible with zoneless.
The `Router` and `HttpClient` also contribute to stability using the
`PendingTasks` injectable. There will likely be more updates in the
future to have more features contribute to stableness in a zoneless
compatible way.

This update uses PendingTasks for stability by default when ZoneJS is not present or
can be enabled with an option when ZoneJS is present (but otherwise ignored with ZoneJS).

fixes #68180
2026-04-20 13:08:43 -07:00
SkyZeroZx
3ae40e6685 refactor(core): complete removal of deprecated createNgModuleRef alias
Finalize the cleanup by removing the remaining `createNgModuleRef` alias.
2026-04-20 12:09:45 -07:00
Bhuvansh855
c610425310 docs: fix wording in reactive forms guide 2026-04-20 09:51:41 -07:00
Bhuvansh855
a718e188c6 docs: improve clarity in dynamic forms guide 2026-04-20 09:30:44 -07:00
Angular Robot
a0d45639a9 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-04-17 15:14:59 -07:00
aparziale
d771a65ac0 refactor: Improve hydration mismatch errors for third-party scripts
Improves error messages shown during hydration mismatches to better
surface cases where third-party scripts or browser extensions have
modified the DOM outside of Angular's control.

Fixed #59224
2026-04-17 14:33:10 -07:00
Angular Robot
279fd7d882 build: update bazel dependencies
See associated pull request for more information.
2026-04-17 14:31:53 -07:00
Andrew Scott
17d10f7a99 fix(router): set default paramsInheritanceStrategy to 'always'
Set the default value of paramsInheritanceStrategy to 'always'. This change ensures that route parameters are inherited from parent routes by default, which is the behavior most users expect. It simplifies routing configuration for the majority of use cases.

This change aligns Angular with other popular routing systems where child routes automatically have access to parent parameters:
- React Router: useParams() includes parent params.
- Vue Router: $route.params includes parent params.
- Next.js: params are passed to nested layouts and pages.
- TanStack Router: useParams() includes parent params with full type safety.

BREAKING CHANGE: paramsInheritanceStrategy now defaults to 'always'

The default value of paramsInheritanceStrategy has been changed from 'emptyOnly' to 'always'. This means that route parameters are inherited from all parent routes by default. To restore the previous behavior, set paramsInheritanceStrategy to 'emptyOnly' in your router configuration.
2026-04-17 14:27:43 -07:00
Angular Robot
56ff89c92d build: update all non-major dependencies
See associated pull request for more information.
2026-04-17 14:26:35 -07:00
pravintargaryen
da6c92eccd docs: add inject to structural directive imports 2026-04-17 14:25:04 -07:00
Angular Robot
421986e49b docs: update cross-repo adev docs
Updated Angular adev cross repo docs files.
2026-04-17 14:24:30 -07:00
Angular Robot
67e4d19597 build: update all github actions
See associated pull request for more information.
2026-04-17 10:54:09 -07:00
Michael Small
0850e20a83 docs: capitalize FormField in form-logic.md imports: [...] 2026-04-17 10:50:51 -07:00
Michael Small
4da3f6c432 docs: fix rxResource example of validateAsync 2026-04-17 10:49:51 -07:00
Christian Oliff
bf4faed626 docs: Fix typo in menubar.md
manubar > menubar
2026-04-17 10:49:15 -07:00
Kam
9c30e74349 docs: fix typo in what-is-angular page
Change "language services powers" to "language service powers".
2026-04-17 10:48:30 -07:00
kirjs
3579ea0850 docs: release notes for the v19.2.21 release 2026-04-16 01:23:00 +03:00
kirjs
9bead58c8b docs: release notes for the v20.3.19 release 2026-04-16 01:10:21 +03:00
kirjs
c326548382 release: cut the v22.0.0-next.8 release 2026-04-16 01:00:28 +03:00
kirjs
05a851ec7f docs: release notes for the v21.2.9 release 2026-04-16 00:37:13 +03:00
Matthieu Riegler
4e331062e8 feat(core): allow synchronous values for stream Resources
In order for resources to allow caching in SSR context (eg in the TransferState), resource need to be able to set their value synchronously.

If the resource value is not set synchronously, the resource will be in in a "loading" state which is responsible for destroying the server-hydrated resolved DOM.
2026-04-16 00:13:04 +03:00
arturovt
79c981840f docs(router): document .. traversal and relativeTo pitfalls in router.navigate()
Explain two non-obvious behaviors of the commands array in router.navigate():

- Multiple '..' segments must be combined in the first array element
  (e.g. ['../../foo']), not spread across separate elements
  (e.g. ['..', '..', 'foo']), because the router only parses '..'
  from the first command string. Subsequent elements are treated as
  literal path segments, causing a navigation error.
- A leading '/' in the first command makes navigation absolute and
  silently ignores the relativeTo option entirely.

Closes #65657
2026-04-15 22:40:42 +03:00
Angular Robot
034b12ffd7 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-04-15 20:22:48 +03:00
SkyZeroZx
281a2dba78 docs: Add guide for debounced signals
Add guide for `debounced` signals.
Also add `@see` tags
2026-04-15 20:04:10 +03:00
Kristiyan Kostadinov
7fa274510f refactor(compiler): move TCB generation logic into compiler
Moves the logic for generating type check blocks into the compiler since it isn't coupled to TypeScript anymore.

Note: the tests haven't been moved over, because they depend on the environment that's currently in `compiler-cli` and it still has some dependencies on TypeScript.
2026-04-15 19:43:29 +03:00
Ben Hong
50a3b0e1ba
docs: add new signal forms - form submission guide 2026-04-15 19:38:35 +03:00
Matthieu Riegler
a46c64758e docs: fix bootstraping link
fixes #68212
2026-04-15 19:25:35 +03:00
Angular Robot
a8132eb2fe docs: update cross-repo adev docs
Updated Angular adev cross repo docs files.
2026-04-15 19:24:48 +03:00
Angular Robot
8b4581d1bb build: lock file maintenance
See associated pull request for more information.
2026-04-15 10:49:13 -04:00
Suleiman Yunus
e32159b5c5 docs: correct "What to learn more about Angular?" to "Want to learn more about Angular?" 2026-04-15 10:33:25 -04:00
arturovt
fc6a7eea68 fix(zone.js): allow draining microtasks in Promise.then (through flag)
These changes are essentially the same as those introduced in
angular#45273, but they include backward compatibility
for applications that explicitly rely on the order in which microtasks are drained.

This is critically important for our code and other third-party code, which is
beyond our control, to work properly. If a microtask is scheduled within an event
listener to be executed "later", it should indeed be executed later and not synchronously,
as this would break the expected flow of code execution.

The simple code that reproduces the behavior that exists now:

```ts
Zone.current.fork({name: 'child'}).run(() => {
  const div = document.createElement('div');
  div.style.height = '200px';
  div.style.width = '200px';
  div.style.backgroundColor = 'red';
  document.body.appendChild(div);

  function listener() {
    Promise.resolve().then(() => {
      div.style.height = '400px';
    });
  }

  div.addEventListener('fakeEvent', listener);
  div.dispatchEvent(new Event('fakeEvent'));
  console.log(div.getBoundingClientRect().height); // 400
});
```

The code above logs 400 as the height, but it should actually log 200 because the
height is updated in a microtask within the event listener.

When using Angular with microfrontend applications, especially when other apps might be
using React, zone.js can disrupt the classical order of operations. For example, when using a
`react-component/trigger`, it schedules a microtask within an event listener using
`Promise.resolve().then(...)` to determine whether the event needs to be re-dispatched.
The event is re-dispatched when the layout has changed, which is why a microtask is used.

With this change, we introduce a global configuration flag,
`__zone_symbol__enable_native_microtask_draining`, to allow consumers to enable
microtask draining within a browser microtask.

This flag is necessary to prevent any breaking changes resulting from this modification.
The previous attempt to address this issue caused a significant number of failures in g3.
Therefore, we are hiding that fix behind the configuration flag.

Closes angular#44446
Closes angular#55590
Closes angular#51328
2026-04-15 10:31:28 -04:00