Commit graph

32312 commits

Author SHA1 Message Date
Matthieu Riegler
bb14fe86e3 refactor(http): add context property to httpResource (#60188)
This was an oversight, `context` can be supported out of the box.

PR Close #60188
2025-03-04 19:57:21 +00:00
Matthieu Riegler
8b8e3fdca4 docs(docs-infra): Don't truncate types in symbol extraction (#59909)
PR Close #59909
2025-03-04 19:54:57 +00:00
Alexis
6f6d9f1e8a docs: Remove misleading default value DEFAULT_CURRENCY_CODE (#59977)
PR Close #59977
2025-03-04 19:37:57 +00:00
Matthieu Riegler
4aeec9fa7d refactor(core): throw an Cyclic Dependency Error in prod mode (#60118)
Prior to this change, cyclic injection didn't trigger any error in prod mode, resulting into injecting the `CIRCULAR` object.
This could lead to strange errors where no method would be found on the token.

fixes #60074

PR Close #60118
2025-03-04 19:37:19 +00:00
naaajii
b4feeb5a7d docs: update license year (#59883)
updates the year in footer and placeholder for generated files

PR Close #59883
2025-03-04 19:36:47 +00:00
kirjs
3902640350 docs: mention that log format makes it analyzable for changelog generation. (#58786)
PR Close #58786
2025-03-04 19:35:54 +00:00
kirjs
215ef78295 docs: sync the scope lists and drop ve (#58786)
PR Close #58786
2025-03-04 19:35:54 +00:00
kirjs
390139e3e1 docs: address comments (#58786)
PR Close #58786
2025-03-04 19:35:54 +00:00
kirjs
7ecaffc008 docs: move commit message guidelies to a separate file (#58786)
PR Close #58786
2025-03-04 19:35:54 +00:00
michael-small
bec6e566bb docs: update version table for 19.2 (#60173)
PR Close #60173
2025-03-04 17:47:09 +00:00
hawkgs
2b114e784d docs(docs-infra): API doc content rendering fixes (#60116)
The PR introduces a few doc content rendering fixes:
- Fix highlighted section heading styles (regression from #59965).
- Convert JSDoc links within 'Usage Notes' sections to HTML and render them.
- Add IDs to doc content headings. This, by itself, makes these headings available in the page ToC.

PR Close #60116
2025-03-04 17:46:30 +00:00
Miles Malerba
ffb19e64f1 fix(compiler-cli): preserve required parens for nullish coalescing (#60060)
Fixes outputted nullish coalescing expressions to not drop parentheses
when it would change the meaning of the expression.

PR Close #60060
2025-03-04 17:44:54 +00:00
Miles Malerba
7e2d5c2203 test(compiler-cli): Update tests for nullish coalescing (#60060)
Updates tests to reflect the fact that we no loger down-level nullish
coalescing.

PR Close #60060
2025-03-04 17:44:53 +00:00
Miles Malerba
2a23209b08 refactor(compiler): stop down-leveling nullish coalescing (#60060)
Stop down-leveling the nullish coalescing (`??`) operator in templates.
Depending on the ES version typescript may still down-level it.

PR Close #60060
2025-03-04 17:44:53 +00:00
Kristiyan Kostadinov
326d48afb4 feat(core): drop support for TypeScript older than 5.8 (#60197)
Narrows down the versions of TypeScript we need to support.

BREAKING CHANGE:
* TypeScript versions less than 5.8 are no longer supported.

PR Close #60197
2025-03-04 17:39:06 +00:00
Andrew Scott
d5e91e04ff fix(language-service): Forward the tags for quick info from the type definition (#59524)
Prior to this commit, the tags from the type definition were dropped.
Tags may include, but are not limited to, deprecation information from
the jsdoc.

PR Close #59524
2025-03-04 17:37:22 +00:00
Andrew Scott
739cadae62 fix(common): Handle errors in async pipe subscriptions (#60057)
`AsyncPipe` would previously promise rejections unhandled and
subscription errors uncaught. This is more or less fine in a Zone-based
application because errors inside the Angular Zone are caught be the
Zone's error trap and reported to `ErrorHandler`. However, in zoneless
applications, these errors are never caught or reported by the FW and
can reach the node process in SSR and cause it to shut down.

BREAKING CHANGE: `AsyncPipe` now directly catches unhandled errors in
subscriptions and promises and reports them to the application's
`ErrorHandler`. For Zone-based applications, these errors would have
been caught by ZoneJS and reported to `ErrorHandler` so the result is
generally the same. The change to the exact mechanism for reporting can
result in differences in test environments that will require test
updates.

PR Close #60057
2025-03-04 17:35:01 +00:00
Lang
0007d20fc9 docs: fix the wrong way to get a signal value (#59194)
PR Close #59194
2025-03-04 17:28:08 +00:00
Lang
5bfe637705 docs: fix typo (#59194)
Co-authored-by: Enea Jahollari <jahollarienea14@gmail.com>
PR Close #59194
2025-03-04 17:28:08 +00:00
Lang
3f65b32ee7 docs: use model API in two-way binding example (#59194)
PR Close #59194
2025-03-04 17:28:08 +00:00
Miles Malerba
2e03a8685b docs(docs-infra): Improve support for @link within the jsdoc. (#60201)
PR Close #60201
2025-03-04 17:13:42 +00:00
hawkgs
56ff3fc5d5 docs: fix AnimationGroupMetadata description (#59733)
Fix the `animations/group()` link.

PR Close #59733
2025-03-04 17:12:10 +00:00
Jeevan Mahesha
e7d0113dad docs: update template syntax to new control flow (#59760)
PR Close #59760
2025-03-04 17:07:05 +00:00
Matthieu Riegler
ba94f6f84f docs(docs-infra): hide github link for external repos. (#60114)
fixes #60113

PR Close #60114
2025-03-04 17:02:37 +00:00
Matthieu Riegler
1bf7494bb3 docs(docs-infra): remove animation package (#60165)
PR Close #60165
2025-03-04 17:01:46 +00:00
Angular Robot
f602e5d66c build: update dependency @types/chrome to ^0.0.307 (#60195)
See associated pull request for more information.

PR Close #60195
2025-03-04 17:00:21 +00:00
Matthieu Riegler
09e17eb718 docs(docs-infra): wait for the DOM to be rendered (#60163)
the code inside `renderExample` is explicitly querying the DOM. We need to wait for it to be rendered for those functions to work.

PR Close #60163
2025-03-04 16:58:14 +00:00
Kristiyan Kostadinov
f2cdb7d9b4 build: update to TypeScript 5.8 final (#60176)
Updates the repo to stable version of TypeScript 5.8.

PR Close #60176
2025-03-04 16:57:35 +00:00
vladboisa
a58b038bb1 docs: change broke link (#60189)
Change the broked link to the working one

PR Close #60189
2025-03-03 22:20:53 +00:00
Pawel Kozlowski
809b5b4596 feat(core): introduce new DI profiling event (#60158)
This change introduces a new DI profiler event:
InjectorToCreateInstanceEvent. This new event allows
us to measure DI tokens instantiation time.

PR Close #60158
2025-03-03 22:06:50 +00:00
Alan Agius
d92fba084b refactor(compiler): remove ngcc binary (#60185)
Remove ngcc deprecation binary

PR Close #60185
2025-03-03 22:05:22 +00:00
Kristiyan Kostadinov
a3cb7b9497 refactor(core): allow InputBinding and OutputBinding to be tree shaken (#60137)
Reworks the `InputBinding` and `OutputBinding` functionality to be in object literals constructed in functions, rather than classes, because it seems like Terser was having a hard time tree shaking the classes when the functions weren't used.

PR Close #60137
2025-03-03 22:04:49 +00:00
Kristiyan Kostadinov
be44cc8f40 feat(core): support listening to outputs on dynamically-created components (#60137)
Adds the new `outputBinding` function that allows users to listen to outputs on dynamically-created components in a similar way to templates. For example, here we create an instance of `MyCheckbox` and listen to its `onChange` event:

```ts
interface CheckboxChange {
  value: string;
}

createComponent(MyCheckbox, {
  bindings: [
   outputBinding<CheckboxChange>('onChange', event => console.log(event.value))
  ],
});
```

Note that while it has always been possible to listen to events like this by getting a hold of of the instance and subscribing to it, there are a few key differences:
1. `outputBinding` behaves in the same way as if the event was bound in a template which comes with some behaviors like forwarding errors to the `ErrorHandler` and marking the view as dirty.
2. With `outputBinding` the listeners will be cleaned up automatically when the component is destroyed.
3. `outputBinding` accounts for host directive outputs by binding to them through the host. E.g. if the `onChange` event above was coming from a host directive, `outputBinding` would bind to it automatically.

Currently `outputBinding` is available only in `createComponent`, `ViewContainerRef.createComponent` and `ComponentFactory.create`, but it will serve as a base for APIs in the future.

PR Close #60137
2025-03-03 22:04:49 +00:00
Kristiyan Kostadinov
3459faadbf fix(core): do not allow setInput to be used with inputBinding (#60137)
Calling `setInput` while the component already has an `inputBinding` active can lead to inconsistent state. These changes add an error that will be thrown if that's the case.

PR Close #60137
2025-03-03 22:04:49 +00:00
Kristiyan Kostadinov
fe57332fc5 feat(core): add input binding support to dynamically-created components (#60137)
Adds the ability to bind to inputs on dynamically-created components, either by targeting the component itself or one of its directives. The new API looks as follows:

```ts
const value = signal(123);

createComponent(MyComp, {
  // Bind the value `'hello'` to `someInput` of `MyComp`.
  bindings: [inputBinding('someInput', () => 'hello')],

  directives: [{
    type: MyDir,
    // Bind the `value` signal to the `otherInput` of `MyDir`.
    bindings: [inputBinding('otherInput', value)]
  }]
});
```

This behavior overlaps with `ComponentRef.setInput`, with a few key differences:
1. `setInput` sets the value on *all* inputs whereas `inputBinding` only targets the specified directive and its host directives. This makes it easier to know which directive you're targeting.
2. `inputBinding` is executed as if it's in a template, making it consistent with how bindings behave for selector-matched components, whereas `setInput` executes outside the lifecycle of the component.
3. It resolves a long-standing issue with `setInput` where it wasn't possible to set the initial value of an input before the first change detection run.

Currently `inputBinding` is used only for `createComponent`, `ViewContainerRef.createComponent` and `ComponentFactory.create`, however it is going to be base for more APIs in the future.

PR Close #60137
2025-03-03 22:04:49 +00:00
Kristiyan Kostadinov
ea5eb28865 fix(core): input targeting not checking if input exists on host (#60137)
Fixes that the `setDirectiveInput` function wasn't checkin if an input exists before writing to it which can lead to assertion errors.

PR Close #60137
2025-03-03 22:04:49 +00:00
Kristiyan Kostadinov
a97e10d623 refactor(core): set up underlying input binding symbols (#60137)
Sets up the symbols used to power the upcoming `inputBinding` functionality.

I also fixed that `setDirectiveInput` was incorrectly only allowing strings for the `value` parameter.

PR Close #60137
2025-03-03 22:04:49 +00:00
Kristiyan Kostadinov
82aa2c1a52 feat(core): add the ability to apply directives to dynamically-created components (#60137)
Updates `createComponent`, `ViewContainerRef.createComponent` and `ComponentFactory.create` to allow the user to specify directives that should be applied when creating the component.

PR Close #60137
2025-03-03 22:04:49 +00:00
Kristiyan Kostadinov
25cae4555a refactor(core): add assertion parameter to getDirectiveDef (#60137)
Some upcoming functionality won't work if we can't retrieve a directive definition from a class. These changes add a `throwIfNotFound` to `getDirectiveDef`, similar to `getNgModuleDef`, to avoid duplication in such cases.

PR Close #60137
2025-03-03 22:04:48 +00:00
Kristiyan Kostadinov
2b12b8a569 refactor(core): move duplicate directive check outside of host directives (#60137)
The check that verifies that there are no duplicates in the directives array was only running after host directive matching since that was the only case when it can happen. After the upcoming changes that won't be the case anymore so these changes move it always run after directive matching.

I also did some additional cleanup by adding comments and by not lazily initializing the `allDirectiveDefs` array when matching host directives. The array is guaranteed to be defined since earlier in the function we verify that there's at least one def with host directives.

PR Close #60137
2025-03-03 22:04:48 +00:00
Kristiyan Kostadinov
93304630a7 refactor(core): move createComponent tests into a separate file (#60137)
Moves the tests for `createComponent` into their own file since the `component_spec.ts` was a bit too generic and was accumulating all sorts of tests.

PR Close #60137
2025-03-03 22:04:48 +00:00
AleksanderBodurri
d260ca3091 feat(core): emit template function for template related profiler hooks (#60174)
Previously, the profiler would only emit the specific template event and context when a template is created/updated, but not the template function related to the event.

This commit emits this function by using the third argument of the profiler function, which previously was only used for lifecycle hooks and output listeners. This commit also renames this arg to eventFn to express that it varies depending on the event type emitting from the profiler.

Note: this change is fully backwards compatible, since previously these template events did not use the third arg of the profiler function.

PR Close #60174
2025-03-03 22:03:44 +00:00
Andrew Scott
a3575e204a refactor(core): Update push/replace navigation to not trigger popstate (#60028)
This matches the spec, though there is a bug in chrome that does trigger these events.

PR Close #60028
2025-03-03 18:40:58 +00:00
Andrew Scott
2e8b84f086 refactor(core): Update fake navigation to more closely follow the spec (#60028)
This commit updates the implementation of the fake navigation to more
closely follow the spec. This includes links to spec parts as well as
some reorganization to have the flow of the code more exactly follow the
corresponding steps in the spec. This makes it easier to verify that th
behavior is correct.

PR Close #60028
2025-03-03 18:40:58 +00:00
Andrew Scott
ae9c7225d4 refactor(core): Ensure fake navigation is not aborted after it succeeds (#60028)
The navigate event was only ever being cleared when a new navigation
happened. That new navigation would abort the previous one, even if it
had already finished successfully.

PR Close #60028
2025-03-03 18:40:58 +00:00
arturovt
36b60a9705 fix(common): clean up onUrlChange listener when root scope is destroyed (#60004)
This cleans up the `onUrlChange` listener once the root scope is destroyed.

PR Close #60004
2025-03-03 17:14:33 +00:00
Andrew Scott
7232ce5b17 fix(core): Catch and report rejections in async function of PendingTasks.run (#60044)
This commit ensures that rejections of the promise of the async function
passed to `PendingTasks.run` are not dangling and get reported to the
application error handler. This prevents what would likely be a common
dangling promise that could end up crashing the node process.

BREAKING CHANGE: `PendingTasks.run` no longer returns the result of the
async function. If this behavior is desired, it can be re-implemented
manually with the `PendingTasks.add`. Be aware, however, that promise rejections
will need to be handled or they can cause the node process to shut down
when using SSR.

PR Close #60044
2025-03-03 17:13:33 +00:00
Doug Parker
d9af1bbf52 release: bump Angular DevTools version to 1.0.24 (#60148)
PR Close #60148
2025-03-03 17:12:23 +00:00
Miles Malerba
51b8ff23ce feat(compiler): support tagged template literals in expressions (#59947)
Adds support for using tagged template literals in Angular templates.

Ex:
```
@Component({
  template: '{{ greet`Hello, ${name()}` }}'
})
export class MyComp {
  name = input();

  greet(strings: TemplateStringsArray, name: string) {
    return strings[0] + name + strings[1] + '!';
  }
}
```

PR Close #59947
2025-02-28 19:53:33 +00:00
Andrew Scott
f9043e24ac fix(compiler-cli): ensure template IDs are not reused if a source file changes (#60152)
This commit fixes a bug where nodes are reused across incremental
compilations. The source file's next template ID is lost because a new
source file is created but nodes may still be retained.

PR Close #60152
2025-02-28 19:53:05 +00:00