0

I am trying to hide ng-option elements based on condition...there is an attribute for disabling the option..but is there any attribute to hide them?

<ng-select class="w-100" (change)="checkingCategory()" formControlName="category" id="category"
                    name="category" placeholder="-Select Category-" bindValue="value">
                    <ng-option [disabled]="category.key == 'BPF' || category.key == 'ENT'" *ngFor="let category of categoryMap | keyvalue" value={{category.key}}>
                        {{category.key}}-{{category.value}}
                    </ng-option>
                </ng-select>
Drenai
  • 11,315
  • 9
  • 48
  • 82

1 Answers1

0

You can't use two * directives on the same element. Try the following

<ng-container 
    *ngFor="let category of categoryMap | keyvalue"
>
   <ng-option *ngIf="someCondition">
   </ng-option>
</ng-container>
Drenai
  • 11,315
  • 9
  • 48
  • 82