fix(ivy): provide an ability to match <ng-template> tags (#27636)
Prior to this change, we were unable to match directives using `ng-template` tags (for example the following selector would not work even though there might be some <ng-template>s in a template: `ng-template[directiveA]`. As a result, that broke some components that relies on such selectors to work. In order to resolve the problem, we now pass tag name to the `template` instruction (where we passed `null` before) and this tag name is used for matching at runtime. This update should also help support projecting containers, because the tag name is required to properly match such elements. PR Close #27636
This commit is contained in:

committed by
Miško Hevery

parent
ea10a3abe5
commit
dfbf6d72b0
@ -73,7 +73,7 @@ export class Element implements Node {
|
||||
|
||||
export class Template implements Node {
|
||||
constructor(
|
||||
public attributes: TextAttribute[], public inputs: BoundAttribute[],
|
||||
public tagName: string, public attributes: TextAttribute[], public inputs: BoundAttribute[],
|
||||
public outputs: BoundEvent[], public children: Node[], public references: Reference[],
|
||||
public variables: Variable[], public sourceSpan: ParseSourceSpan,
|
||||
public startSourceSpan: ParseSourceSpan|null, public endSourceSpan: ParseSourceSpan|null,
|
||||
@ -189,8 +189,8 @@ export class TransformVisitor implements Visitor<Node> {
|
||||
newChildren != template.children || newVariables != template.variables ||
|
||||
newReferences != template.references) {
|
||||
return new Template(
|
||||
newAttributes, newInputs, newOutputs, newChildren, newReferences, newVariables,
|
||||
template.sourceSpan, template.startSourceSpan, template.endSourceSpan);
|
||||
template.tagName, newAttributes, newInputs, newOutputs, newChildren, newReferences,
|
||||
newVariables, template.sourceSpan, template.startSourceSpan, template.endSourceSpan);
|
||||
}
|
||||
return template;
|
||||
}
|
||||
|
Reference in New Issue
Block a user