Skip to content

Control flow migration wrongly removes ng-template when it is referenced with preceding whitespace characters #64854

@lukasmatta

Description

@lukasmatta

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

core

Is this a regression?

No

Description

It seems that in PR #64745 that should have fixed #64741 I missed a case with preceding whitespace characters before the template name. For example, in the following case, the ng-template definition would be incorrectly removed. Note that there are whitespace characters between ngTemplateOutlet=" and sampleTemplate.

<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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions