Skip to content

Control flow schematic: async pipe + let + else usage produces invalid code #53150

@mattlewis92

Description

@mattlewis92

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

core

Is this a regression?

No

Description

Input:

<div *ngIf="item$ | async; let item; else: loadingTemplate"></div>
<ng-template #loadingTemplate> Loading </ng-template>

Output:

@if (item$ | async; as item) {
  <div></div>
} @else {
  #: loadingTemplate|
}
<ng-template #loadingTemplate> Loading </ng-template>

Please provide a link to a minimal reproduction of the bug

See above for a minimal test case

Please provide the exception or error you saw

N/A

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

Angular CLI: 17.0.3
Node: 18.17.1
Package Manager: pnpm 8.10.5
OS: darwin arm64

Angular: 17.0.4
... animations, common, compiler, compiler-cli, core, elements
... forms, language-service, localize, platform-browser
... platform-browser-dynamic, router, service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1700.1
@angular-devkit/build-angular   17.0.3
@angular-devkit/core            17.0.3
@angular-devkit/schematics      17.0.3
@angular/cdk                    17.0.1
@angular/cli                    17.0.3
@angular/google-maps            15.2.9
@schematics/angular             17.0.3
ng-packagr                      17.0.2
rxjs                            7.8.0
typescript                      5.2.2
webpack                         5.88.2
zone.js                         0.14.2

Anything else?

No response

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