fix(core): handle <ng-template> with local refs in i18n blocks (#35758)

This commit extends the range of tNode types that may have local refs to include `TNodeType.Container` to account for `<ng-template>`s. Original changes in https://github.com/angular/angular/pull/33415 didn't include that type and as a result, an error is thrown at runtime in case an i18n block contains an `<ng-template>` with local refs.

PR Close #35758
This commit is contained in:
Andrew Kushnir
2020-02-28 09:07:37 -08:00
committed by atscott
parent 40035380e7
commit ef75875ca3
2 changed files with 14 additions and 4 deletions

View File

@ -701,7 +701,8 @@ function i18nEndFirstPass(tView: TView, lView: LView) {
}
// Check if an element has any local refs and skip them
const tNode = getTNode(tView, index);
if (tNode && (tNode.type === TNodeType.Element || tNode.type === TNodeType.ElementContainer) &&
if (tNode && (tNode.type === TNodeType.Container || tNode.type === TNodeType.Element ||
tNode.type === TNodeType.ElementContainer) &&
tNode.localNames !== null) {
// Divide by 2 to get the number of local refs,
// since they are stored as an array that also includes directive indexes,