Skip to content

Control flow schematic: ngIfElse input is not removed after migration #53230

Closed

Description

@mattlewis92

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

core

Is this a regression?

No

Description

Input:

<ng-template
  [ngIf]="false"
  [ngIfElse]="fooTemplate"
  [ngTemplateOutlet]="barTemplate"
>
</ng-template>

<ng-template #fooTemplate>
  Foo
</ng-template>

<ng-template #barTemplate>
  Bar
</ng-template>

Output:

@if (false) {
  <ng-template
    [ngIfElse]="fooTemplate"
    [ngTemplateOutlet]="barTemplate"
    >
  </ng-template>
} @else {
  Foo
}
<ng-template #fooTemplate>
  Foo
</ng-template>
<ng-template #barTemplate>
  Bar
</ng-template>

Expected ([ngIfElse]="fooTemplate" + associated ng-template should be removed):

@if (false) {
  <ng-template
    [ngTemplateOutlet]="barTemplate"
    >
  </ng-template>
} @else {
  Foo
}
<ng-template #barTemplate>
  Bar
</ng-template>

Please provide a link to a minimal reproduction of the bug

N/A

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.3
Node: 20.9.0
Package Manager: pnpm 8.11.0
OS: darwin arm64

Angular: 17.1.0-next.1+sha-f1b7d40
... core

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/animations                 17.0.4
@angular/cdk                        17.0.1
@angular/cli                        17.0.3
@angular/common                     17.0.4
@angular/compiler                   17.0.4
@angular/compiler-cli               17.0.4
@angular/elements                   17.0.4
@angular/forms                      17.0.4
@angular/google-maps                15.2.9
@angular/language-service           17.0.4
@angular/localize                   17.0.4
@angular/platform-browser           17.0.4
@angular/platform-browser-dynamic   17.0.4
@angular/router                     17.0.4
@angular/service-worker             17.0.4
@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?

Noting that I have installed the latest dev build against the main branch via "@angular/core": "angular/core-builds#17.1.0-next.1+f1b7d40", to get the latest fixes

Activity

  1. added
    area: migrations
    core: control flow
    on Nov 28, 2023
  2. added this to the needsTriage milestone on Nov 28, 2023
  3. jessicajaniuk commented on Nov 28, 2023

    @jessicajaniuk
    Contributor

    @mattlewis92 These are excellent bug reports. Thank you for your clarity and great examples!

  4. mattlewis92 commented on Nov 28, 2023

    @mattlewis92
    ContributorAuthor

    @mattlewis92 These are excellent bug reports. Thank you for your clarity and great examples!

    No problem, thank you for the super quick turnaround with fixing them! We have over 3000 components so lots of test cases 😅

  5. jessicajaniuk commented on Nov 28, 2023

    @jessicajaniuk
    Contributor

    The fix is in #53236. Thanks!

  6. added a commit that references this issue on Nov 28, 2023
    406c203
  7. added a commit that references this issue on Nov 29, 2023
    dffeac8
  8. angular-automatic-lock-bot commented on Dec 30, 2023

    @angular-automatic-lock-bot

    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.

  9. locked and limited conversation to collaborators on Dec 30, 2023
  10. added a commit that references this issue on Jan 23, 2024
    2999e57
  11. added a commit that references this issue on Jan 26, 2024
    7a109f1
  12. added a commit that references this issue on Jan 26, 2024
    ced8adf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: migrationscore: control flowstate: has PR

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions