Deliver web apps with confidence 🚀
Find a file
Doug Parker 4930ed3fed refactor(devtools): add support for mutating objects inside signals (#60381)
Angular DevTools now supports mutating objects underneath signals in the property explorer view.

This is done by performing an "immutable update" by recursively copying objects underneath a signal and overwriting the one property specified. For example, if the user attempted to set `foo.bar.baz[2].hello = 'world'` and `bar` was a signal, this would effectively become:

```typescript
foo.bar.set({
  ...foo.bar(),
  baz: [
    ...foo.bar().baz.slice(0, 2),
    {
      ...foo.bar().baz[2],
      hello: 'world',
    },
    ...foo.bar().baz.slice(3),
  ],
})
```

The motivation for immutable updates is because signals and Angular change detection don't really like interior mutability of signal values. If we didn't do this, any kind of comparison or dirty check would prevent the UI from updating. If an application attempts to change a deeply nested property inside a signal, it doesn't work today. DevTools should generally be limited to operations an application could do itself, and the recommended approach to make such a change like this is an immutable update. Creating entirely new objects intentionally breaks referential equality such that the application can properly react to the change.

Unfortunately, it is not possible to make immutable updates in a truly generic sense. You can't just copy a class for instance `({...new MyFoo()}).doSomething()`. We could do something fancier like manually copying over the prototype or something like that, but there is no way to do this without breaking class semantics (ex. the class might reasonably rely on the constructor being called). Therefore we instead reject any mutations to non-primitive objects. In the future, we might expand the set of "primitives" to include other built-ins and well-known objects like `URL` or `Element`, but those are out of scope for now.

I opted to ban mutating the result of a readonly/computed signal. While the mutation is likely to succeed, a subsequent rerun of the `computed` will immediately drop the change. However, I opted to allow mutating the result of a getter property. This has a similar problem because it might be returning a synthetic object which will be invalidated on the next execution, but it is possible and reasonable for a getter to return the same object multiple times such that a mutation may reasonably survive other updates. DevTools can't easily know whether a getter actually will return the same object on each execution or not, so we optimistically assume the reference is stable. If it isn't, the mutation will be lost whenever the getter is re-executed.

PR Close #60381
2025-03-18 10:22:46 +01:00
.devcontainer ci: remove circleci as we no longer rely on it (#58615) 2024-11-12 18:39:25 +00:00
.github build: update cross-repo angular dependencies (#60405) 2025-03-18 10:19:04 +01:00
.husky build: simplify husky setup (#54315) 2024-02-07 16:34:13 +00:00
.ng-dev docs: address comments (#58786) 2025-03-04 19:35:54 +00:00
.vscode build: add ignore revs file for git blame (#60117) 2025-02-26 16:19:25 -05:00
.yarn build: update yarn to 1.22.22 (#58448) 2024-10-31 19:06:16 +01:00
adev docs: fix typo (#60431) 2025-03-18 10:11:58 +01:00
contributing-docs docs: mention that log format makes it analyzable for changelog generation. (#58786) 2025-03-04 19:35:54 +00:00
devtools refactor(devtools): add support for mutating objects inside signals (#60381) 2025-03-18 10:22:46 +01:00
goldens feat(core): add support for two-way bindings on dynamically-created components (#60342) 2025-03-17 14:29:52 +01:00
integration refactor: replace fast-glob usage with tinyglobby (#60264) 2025-03-07 10:57:23 -08:00
modules docs: update license URL from angular.io to angular.dev and year of license to 2025 (#59407) 2025-01-09 10:27:54 -05:00
packages build: improve partial compliance golden generation and add debug logging (#60427) 2025-03-18 07:10:43 +00:00
scripts ci: remove circleci as we no longer rely on it (#58615) 2024-11-12 18:39:25 +00:00
third_party build: create NodeJS ESM loader for supporting Bazel setup (#48521) 2022-12-19 19:50:40 +00:00
tools build: properly compile tests in core with Angular compiler (#60268) 2025-03-07 11:00:47 -08:00
.bazelignore build: update .bazelignore listings (#60239) 2025-03-06 07:56:34 -08:00
.bazelrc build: upload grpc remote logs for debugging (#60393) 2025-03-14 19:51:26 +01:00
.bazelversion build: update to bazel v5 for new runfiles API used in dev-infra (#45407) 2022-03-21 16:55:36 -07:00
.clang-format feat(tooling): Add a .clang-format for automated JavaScript formatting. 2015-04-02 08:44:34 -07:00
.editorconfig build: use https link to editorconfig.org in .editorconfig (#27664) 2018-12-18 09:30:09 -08:00
.git-blame-ignore-revs build: add ignore revs file for git blame (#60117) 2025-02-26 16:19:25 -05:00
.gitattributes build: cleanup .gitattributes file and remove outdated CRLF attribute (#46513) 2022-06-28 13:38:27 -07:00
.gitignore build: correct ignore nested node_modules (#58821) 2024-11-22 14:56:23 +00:00
.gitmessage docs: move commit message guidelies to a separate file (#58786) 2025-03-04 19:35:54 +00:00
.mailmap build: add a Git .mailmap with my new name (#19550) 2017-10-09 14:35:30 -07:00
.npmrc build: rely on engines to prevent using npm for dependency install (#41477) 2021-04-07 12:05:01 -07:00
.nvmrc build: update minimum development Node.js versions (#60080) 2025-03-10 09:45:05 -07:00
.prettierrc build: Update prettierrc to always use trailing commas (#58266) 2024-11-04 18:14:05 +01:00
.pullapprove.yml build: update public-api approvers (#60328) 2025-03-11 11:07:18 -07:00
.yarnrc build: update yarn to 1.22.22 (#58448) 2024-10-31 19:06:16 +01:00
browser-providers.conf.d.ts build: share Saucelabs browsers between karma test targets using background Saucelabs daemon and custom karma launcher (#49200) 2023-05-15 09:21:46 -07:00
browser-providers.conf.js refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
BUILD.bazel build: update yarn to 1.22.22 (#58448) 2024-10-31 19:06:16 +01:00
CHANGELOG.md release: cut the v20.0.0-next.2 release 2025-03-12 09:52:39 -07:00
CHANGELOG_ARCHIVE.md docs: fix typos 2023-06-22 12:56:49 +02:00
CODE_OF_CONDUCT.md build: update CODE_OF_CONDUCT.md to match the content of angular/.github 2023-03-13 21:07:51 +00:00
CONTRIBUTING.md docs: fix commit message guideline link (#60296) 2025-03-11 11:08:23 -07:00
gulpfile.js refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
karma-js.conf.js ci: remove circleci as we no longer rely on it (#58615) 2024-11-12 18:39:25 +00:00
LICENSE docs: update copyright year (#59359) 2025-01-06 19:58:30 +00:00
package.json build: update cross-repo angular dependencies (#60405) 2025-03-18 10:19:04 +01:00
packages.bzl refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
README.md docs: add Bluesky links (#59661) 2025-01-22 07:58:15 -08:00
renovate.json ci: disable Renovate updates for @angular/build-tooling (#60387) 2025-03-14 14:43:24 +01:00
SECURITY.md docs: update security guide link to adev (#56469) 2024-06-17 08:54:08 -07:00
tsconfig-tslint.json docs(docs-infra): enable tslint (#58961) 2024-12-05 16:03:35 -08:00
tslint.json refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
WORKSPACE build: update io_bazel_rules_sass digest to ebdb141 (#60428) 2025-03-18 10:18:16 +01:00
yarn.bzl build: update yarn to 1.22.22 (#58448) 2024-10-31 19:06:16 +01:00
yarn.lock build: update cross-repo angular dependencies (#60405) 2025-03-18 10:19:04 +01:00

Angular - The modern web developer's platform

angular-logo
Angular is a development platform for building mobile and desktop web applications
using TypeScript/JavaScript and other languages.

angular.dev

Contributing Guidelines · Submit an Issue · Blog

Angular on npm   Discord conversation


Documentation

Get started with Angular, learn the fundamentals and explore advanced topics on our documentation website.

Advanced

Local Development

To contribute to the Angular Docs, check out the Angular.dev README

Development Setup

Prerequisites

Setting Up a Project

Install the Angular CLI globally:

npm install -g @angular/cli

Create workspace:

ng new [PROJECT NAME]

Run the application:

cd [PROJECT NAME]
ng serve

Angular is cross-platform, fast, scalable, has incredible tooling, and is loved by millions.

Quickstart

Get started in 5 minutes.

Ecosystem

angular ecosystem logos

Changelog

Learn about the latest improvements.

Upgrading

Check out our upgrade guide to find out the best way to upgrade your project.

Contributing

Contributing Guidelines

Read through our contributing guidelines to learn about our submission process, coding rules, and more.

Want to Help?

Want to report a bug, contribute some code, or improve the documentation? Excellent! Read up on our guidelines for contributing and then check out one of our issues labeled as help wanted or good first issue.

Code of Conduct

Help us keep Angular open and inclusive. Please read and follow our Code of Conduct.

Community

Join the conversation and help the community.

Love Angular badge

Love Angular? Give our repo a star ⬆️.