Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
Yes
Description
Consider the template below.
app.component.html
<!-- OK -->
<span i18n>
meow
<span *ngIf="true; else elseBlock">meow?</span>
<ng-template #elseBlock>
<span>meow!</span>
</ng-template>
</span>
<!-- Not OK -->
<span i18n>
meow
@if(true) {
<span>meow?</span>
} @else {
<span>meow!</span>
}
</span>
When the @if block is inside a regular HTML element having an i18n attribute, it will abort compilation with the following error message:
✘ [ERROR] Angular compilation emit failed. [plugin angular-compiler]
TypeError: Cannot read properties of undefined (reading 'startName')
at file:///workspaces/barebones-nodejs/ng17/node_modules/@angular/compiler/fesm2022/compiler.mjs:26452:37
at Array.forEach (<anonymous>)
at I18nContext.reconcileChildContext (file:///workspaces/barebones-nodejs/ng17/node_modules/@angular/compiler/fesm2022/compiler.mjs:26451:28)
at TemplateDefinitionBuilder.i18nEnd (file:///workspaces/barebones-nodejs/ng17/node_modules/@angular/compiler/fesm2022/compiler.mjs:26948:30)
at TemplateDefinitionBuilder.buildTemplateFunction (file:///workspaces/barebones-nodejs/ng17/node_modules/@angular/compiler/fesm2022/compiler.mjs:26748:18)
at file:///workspaces/barebones-nodejs/ng17/node_modules/@angular/compiler/fesm2022/compiler.mjs:27275:50
at file:///workspaces/barebones-nodejs/ng17/node_modules/@angular/compiler/fesm2022/compiler.mjs:26729:60
at Array.forEach (<anonymous>)
at TemplateDefinitionBuilder.buildTemplateFunction (file:///workspaces/barebones-nodejs/ng17/node_modules/@angular/compiler/fesm2022/compiler.mjs:26729:33)
at compileComponentFromMetadata (file:///workspaces/barebones-nodejs/ng17/node_modules/@angular/compiler/fesm2022/compiler.mjs:28917:60)
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run ng version)
Angular CLI: 17.0.0
Node: 18.18.2
Package Manager: npm 9.8.1
OS: linux x64
Angular: 17.0.2
... animations, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1700.0
@angular-devkit/build-angular 17.0.0
@angular-devkit/core 17.0.0
@angular-devkit/schematics 17.0.0
@angular/cli 17.0.0
@schematics/angular 17.0.0
rxjs 7.8.1
typescript 5.2.2
zone.js 0.14.2
Anything else?
No response
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
Yes
Description
Consider the template below.
app.component.html
When the
@ifblock is inside a regular HTML element having ani18nattribute, it will abort compilation with the following error message:Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run
ng version)Anything else?
No response