Skip to content

control flow migration: ngIf else error #53113

@e-oz

Description

@e-oz

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

No

Description

Was:

<span *ngIf="instance.name else unnamed">{{instance.name}}</span>

<ng-template #unnamed>
    <span i18n>Unnamed Instance</span>
  </ng-template>

After migration:

@if (b.name else unnamed) {
  <span>{{b.name}}</span>
}

<ng-template #unnamed>
    <span i18n>Unnamed Instance</span>
  </ng-template>

it gives error: NG5002: Parser Error: Unexpected token 'else'

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

NG5002: Parser Error: Unexpected token 'else'

Please provide the environment you discovered this bug in (run ng version)

"@angular/core": "^17.0.4"

Anything else?

I have to say, that this migration right now works much better - thank you for all bugfixes!

Metadata

Metadata

Assignees

Labels

area: migrationsIssues related to `ng update`/`ng generate` migrationscore: control flowIssues related to the built-in control flow (@if, @for, @switch)

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions