-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Control flow migration wrongly removes ng-template in a specific scenario #64741
Copy link
Copy link
Closed
Description
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
No
Description
The definition of the ng-template is wrongly removed after running ng generate @angular/core:control-flow in a specific scenario.
Before:
<div *ngIf="sampleVar else sampleTemplate">
<ng-container *ngTemplateOutlet="sampleTemplate; context: {
value: 'sampleVar is true'
}">
</ng-container>
</div>
<ng-template #sampleTemplate let-value="value">
<h1>{{ value ?? "sampleVar is false" }}</h1>
</ng-template>After (see the definition of sampleTemplate has been removed even though it is still being used):
@if (sampleVar) {
<div>
<ng-container *ngTemplateOutlet="sampleTemplate; context: {
value: 'sampleVar is true'
}">
</ng-container>
</div>
} @else {
<h1>{{ value ?? "sampleVar is false" }}</h1>
}Please provide a link to a minimal reproduction of the bug
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run ng version)
Anything else?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels