Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

control-flow migration doesnt migrate code with *ngIf else directive #52502

Closed
naveedahmed1 opened this issue Nov 3, 2023 · 3 comments
Closed
Assignees
Labels
area: migrations Issues related to `ng update` migrations bug state: has PR
Milestone

Comments

@naveedahmed1
Copy link
Contributor

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

core

Is this a regression?

Yes

Description

I recently tried control flow migration schematics for my project using command ng generate @angular/core:control-flow although this time the command didnt throw any error but it didnt work either.

For eample for below teamplate:

<div *ngIf="list?.length>0;else noItemFound">
</div>
<ng-template #noItemFound>No item found</ng-template>

Below is the code that this migration produced:

 @if (list?.length>0;else noItemFound) {

}

<ng-template #noItemFound>No item found</ng-template>

Please provide a link to a minimal reproduction of the bug

For this I can add you to a private repo

Please provide the exception or error you saw

No exception was thrown but migrations didn't work

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

Angular CLI: 17.0.0-rc.3
Node: 18.18.2
Package Manager: npm 9.8.1
OS: win32 x64

Angular: 17.0.0-rc.2
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router, service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1700.0-rc.3
@angular-devkit/build-angular   17.0.0-rc.3
@angular-devkit/core            17.0.0-rc.3
@angular-devkit/schematics      17.0.0-rc.3
@angular/cdk                    17.0.0-rc.1
@angular/cli                    17.0.0-rc.3
@angular/fire                   16.0.0
@angular/google-maps            17.0.0-rc.1
@angular/material               17.0.0-rc.1
@angular/pwa                    17.0.0-rc.3
@schematics/angular             17.0.0-rc.3
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.0

Anything else?

No response

@crisbeto crisbeto self-assigned this Nov 3, 2023
@crisbeto crisbeto added state: has PR area: migrations Issues related to `ng update` migrations bug labels Nov 3, 2023
crisbeto added a commit to crisbeto/angular that referenced this issue Nov 3, 2023
Fixes that the control flow migration wasn't migrating an `*ngIf` with an `else` condition that doesn't have spaces before the `else`.

Fixes angular#52502.
@ngbot ngbot bot added this to the needsTriage milestone Nov 3, 2023
@crisbeto
Copy link
Member

crisbeto commented Nov 3, 2023

It's because there's no space after the else. I've sent #52504 with a fix.

atscott pushed a commit that referenced this issue Nov 3, 2023
Fixes that the control flow migration wasn't migrating an `*ngIf` with an `else` condition that doesn't have spaces before the `else`.

Fixes #52502.

PR Close #52504
@atscott atscott closed this as completed in 1da4a24 Nov 3, 2023
@naveedahmed1
Copy link
Contributor Author

Thank you @crisbeto and @atscott :)

Abseil-byte pushed a commit to Abseil-byte/angular that referenced this issue Nov 5, 2023
…lar#52504)

Fixes that the control flow migration wasn't migrating an `*ngIf` with an `else` condition that doesn't have spaces before the `else`.

Fixes angular#52502.

PR Close angular#52504
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 5, 2023
tbondwilkinson pushed a commit to tbondwilkinson/angular that referenced this issue Dec 6, 2023
…lar#52504)

Fixes that the control flow migration wasn't migrating an `*ngIf` with an `else` condition that doesn't have spaces before the `else`.

Fixes angular#52502.

PR Close angular#52504
ChellappanRajan pushed a commit to ChellappanRajan/angular that referenced this issue Jan 23, 2024
…lar#52504)

Fixes that the control flow migration wasn't migrating an `*ngIf` with an `else` condition that doesn't have spaces before the `else`.

Fixes angular#52502.

PR Close angular#52504
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: migrations Issues related to `ng update` migrations bug state: has PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants