You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Control flow schematic: async pipe + let + else usage produces invalid code #53150
area: migrationsIssues related to `ng update`/`ng generate` migrationscore: control flowIssues related to the built-in control flow (@if, @for, @switch)
@mattlewis92 Thanks for filing this! This is happening because there's a colon after the else in your initial template, which is not the proper syntax for an ngIf/else. The migration is not expecting that to be present.
<div*ngIf="item$ | async; let item; else loadingTemplate"></div><ng-template#loadingTemplate> Loading </ng-template>
area: migrationsIssues related to `ng update`/`ng generate` migrationscore: control flowIssues related to the built-in control flow (@if, @for, @switch)
Activity
jessicajaniuk commentedon Nov 27, 2023
@mattlewis92 Thanks for filing this! This is happening because there's a colon after the
elsein your initial template, which is not the proper syntax for an ngIf/else. The migration is not expecting that to be present.mattlewis92 commentedon Nov 27, 2023
Odd, having the colon after the
elsedoes appear to actually work, even though it's not official angular syntax: https://stackblitz.com/edit/stackblitz-starters-3wtqjv?file=src%2Fmain.tsBut luckily we don't have a huge amount of cases of this in our codebase, so I'll just manually fix these before running the migration 😄
mattlewis92 commentedon Nov 27, 2023
Ah, it seems like prettier is responsible for adding the extra colon after the else condition:
I guess a bug should be filed there?
jessicajaniuk commentedon Nov 27, 2023
@mattlewis92 Yeah, since it works, it's likely you're not the only one with this issue. I'll put up a fix for it.
jessicajaniuk commentedon Nov 27, 2023
@mattlewis92 Yeah that would be great if you could file that bug with prettier. Thank you! In the meantime, a fix should be out shortly.
mattlewis92 commentedon Nov 27, 2023
Thank you so much for the fast response!
I've filed the bug with prettier: prettier/prettier#15719
fix(migrations): allows colons in ngIf else cases to migrate (#53076)
angular-automatic-lock-bot commentedon Dec 29, 2023
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
fix(migrations): allows colons in ngIf else cases to migrate (angular…
fix(migrations): allows colons in ngIf else cases to migrate (angular…
fix(migrations): allows colons in ngIf else cases to migrate (angular…