fix(core): incorrectly validating properties on ng-content and ng-container (#37773)

Fixes the following issues related to how we validate properties during JIT:
- The invalid property warning was printing `null` as the node name
for `ng-content`. The problem is that when generating a template from
 `ng-content` we weren't capturing the node name.
- We weren't running property validation on `ng-container` at all.
This used to be supported on ViewEngine and seems like an oversight.

In the process of making these changes, I found and cleaned up a
few places where we were passing in `LView` unnecessarily.

PR Close #37773
This commit is contained in:
crisbeto
2020-07-15 07:03:04 +02:00
committed by Andrew Kushnir
parent 406f801b70
commit bf641e1b4b
6 changed files with 116 additions and 15 deletions

View File

@ -104,6 +104,8 @@ export class Template implements Node {
}
export class Content implements Node {
readonly name = 'ng-content';
constructor(
public selector: string, public attributes: TextAttribute[],
public sourceSpan: ParseSourceSpan, public i18n?: I18nMeta) {}

View File

@ -233,10 +233,10 @@ class HtmlAstToIvyAst implements html.Visitor {
// TODO(pk): test for this case
parsedElement = new t.Template(
(parsedElement as t.Element).name, hoistedAttrs.attributes, hoistedAttrs.inputs,
hoistedAttrs.outputs, templateAttrs, [parsedElement], [/* no references */],
templateVariables, element.sourceSpan, element.startSourceSpan, element.endSourceSpan,
i18n);
(parsedElement as t.Element | t.Content).name, hoistedAttrs.attributes,
hoistedAttrs.inputs, hoistedAttrs.outputs, templateAttrs, [parsedElement],
[/* no references */], templateVariables, element.sourceSpan, element.startSourceSpan,
element.endSourceSpan, i18n);
}
if (isI18nRootElement) {
this.inI18nBlock = false;