angular/packages/core
Kristiyan Kostadinov 9c55fcb3e6 feat(core): de-duplicate host directives
With host directives we can end up in a situation where the same directive applies multiple times to the same element, potentially with conflicting configurations. The runtime isn't set up for a directive to apply more than once so historically we were throwing an error when we detect duplicates.

This ended up limiting the usefulness of host directives to library authors, because it meant that host directives couldn't be reused as much as authors wanted. To address the issue, these changes introduce logic in the compiler and runtime that will de-duplicate host directives with the following logic:

1. If a directive matches once in the template and more than once as a host directive, the host directive matches will be discarded and only the template match will apply. The mental model is that a host directive match represents `Partial<YourDirective>` while a template match represents the full `YourDirective`.
2. If a directive matches multiple times as a host directive, we merge the input/output mappings from all the instances into a single one. If we detect a case where an input/output is exposed under multiple names during the merging process, both the compiler and the runtime will produce an error.

Fixes #57846.
2026-04-03 09:44:39 -07:00
..
global build: rename defaults2.bzl to defaults.bzl (#63383) 2025-08-25 15:45:01 -07:00
primitives test(core): refactors test to use timeout utility 2026-04-01 20:46:00 +02:00
resources fix(core): Remove note to skip arrow functions in best practices 2026-01-20 10:42:42 -08:00
rxjs-interop test(core): refactors test to use timeout utility 2026-04-01 20:46:00 +02:00
schematics feat(migrations): Add migration for CanMatchFn snapshot parameter (#67452) 2026-04-02 12:53:57 -07:00
src feat(core): de-duplicate host directives 2026-04-03 09:44:39 -07:00
test feat(core): de-duplicate host directives 2026-04-03 09:44:39 -07:00
testing refactor: prepare for required changeDetection prop on G3. 2026-03-20 15:52:38 -07:00
BUILD.bazel refactor(core): export profile event as enum and move profile_types.ts and framework to shared devtools folder 2025-11-19 15:22:49 -08:00
index.ts refactor: update packages/core:{core,src} to ts_project (#61275) 2025-05-14 12:01:51 +00:00
package.json build: update minimum supported Node.js versions 2026-02-25 07:57:18 -08:00
PACKAGE.md build: format md files 2025-11-06 10:03:05 -08:00
public_api.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
tsconfig-build.json build: migrate more targets of @angular/core to ts_project (#61370) 2025-05-16 11:02:07 +00:00
tsconfig-test.json build: migrate more targets of @angular/core to ts_project (#61370) 2025-05-16 11:02:07 +00:00