Skip to content

[igx-select] items inside if/else condition don't render #17164

@pmoleri

Description

@pmoleri

Description

When putting <igx-select-item> inside an @if / @else condition they don't render.

  • igniteui-angular version: 21.1
  • browser: any

Steps to reproduce

  1. Use a condition like this one:
    <igx-select #select>
      <label igxLabel>Even/Odd Select</label>
      @for (item of items; track item; let e = $even) {
        @if ($even) {
          <igx-select-item [value]="item"> even: {{ item }} </igx-select-item>
        } @else {
          <igx-select-item [value]="item"> odd: {{ item }} </igx-select-item>
        }
      }
    </igx-select>

Result

The select dropdown renders empty

Expected result

Items are still rendered.

I'm not sure if this is a limitation of the component or of Angular.
The limitation could be avoided by moving the conditions inside the element.

Attachments

Stackblitz: https://stackblitz.com/edit/qgbuhzqd?file=src%2Fapp%2Fselect-sample-1%2Fselect-sample-1.component.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions