f535f31d78
The content projection mechanism is static, in that it only looks at the static template nodes before directives are matched and change detection is run. When you have a selector-based content projection the selection is based on nodes that are available in the template. For example: ``` <ng-content selector="[some-attr]"></ng-content> ``` would match ``` <div some-attr="..."></div> ``` If you have an inline-template in your projected nodes. For example: ``` <div *ngIf="..." some-attr="..."></div> ``` This gets pre-parsed and converted to a canonical form. For example: ``` <ng-template [ngIf]="..."> <div some-attr=".."></div> </ng-template> ``` Note that only structural attributes (e.g. `*ngIf`) stay with the `<ng-template>` node. The other attributes move to the contained element inside the template. When this happens in ivy, the ng-template content is removed from the component template function and is compiled into its own template function. But this means that the information about the attributes that were on the content are lost and the projection selection mechanism is unable to match the original `<div *ngIf="..." some-attr>`. This commit adds support for this in ivy. Attributes are separated into three groups (Bindings, Templates and "other"). For inline-templates the Bindings and "other" types are hoisted back from the contained node to the `template()` instruction, so that they can be used in content projection matching. PR Close #29041 |
||
---|---|---|
.. | ||
aot | ||
css_parser | ||
expression_parser | ||
i18n | ||
ml_parser | ||
output | ||
render3 | ||
schema | ||
selector | ||
template_parser | ||
BUILD.bazel | ||
compiler_facade_interface_spec.ts | ||
config_spec.ts | ||
core_spec.ts | ||
directive_lifecycle_spec.ts | ||
directive_normalizer_spec.ts | ||
directive_resolver_mock_spec.ts | ||
directive_resolver_spec.ts | ||
integration_spec.ts | ||
metadata_resolver_fixture.ts | ||
metadata_resolver_spec.ts | ||
ng_module_resolver_mock_spec.ts | ||
ng_module_resolver_spec.ts | ||
parse_util_spec.ts | ||
pipe_resolver_mock_spec.ts | ||
pipe_resolver_spec.ts | ||
resource_loader_mock_spec.ts | ||
runtime_compiler_spec.ts | ||
shadow_css_spec.ts | ||
spies.ts | ||
style_url_resolver_spec.ts | ||
test_bindings.ts | ||
url_resolver_spec.ts | ||
util_spec.ts |