mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
Consider an `ng-template` which is generated as a result of a structural directive:
```
<div *ngFor="let inner of items"
(click)="onClick(inner)"
[title]="getTitle()"
>
```
This should logically expand into something like the following:
```
<ng-template [ngForOf]="..." >
<div (click)="..." [title]="..."></div>
</ng-template>
```
Note that the `(click)` handler and the `[title]` property are only present on the inner div, *not* on the enclosing generated `ng-template`.
Previously, Template Pipeline would place these bindings on *both* the tempate and the inner element.
However, we can't just remove them completely, because these bindings should still be matchable on the generated `ng-template` (which is very surprising, but nonetheless true).
We resolve this issue with two improvements:
(1) The ingestion step is now much smarter about determining not only if a binding is on a template element, but whether it actually targets that template element.
(2) We use `ExtractedAttributeOp` directly, rather than going through `BindingOp`, to cause the `ng-template` to still receive these bindings in its `consts` array for matching purposes.
PR Close #51950
|
||
|---|---|---|
| .. | ||
| r3_compiler_compliance | ||
| r3_view_compiler | ||
| r3_view_compiler_bindings | ||
| r3_view_compiler_control_flow | ||
| r3_view_compiler_deferred | ||
| r3_view_compiler_di/di | ||
| r3_view_compiler_directives | ||
| r3_view_compiler_i18n | ||
| r3_view_compiler_input_outputs | ||
| r3_view_compiler_listener | ||
| r3_view_compiler_providers | ||
| r3_view_compiler_styling | ||
| r3_view_compiler_template | ||
| source_mapping | ||
| BUILD.bazel | ||
| list_golden_update_rules.ts | ||
| test_case_schema.json | ||