What is the efficient way to check if a string is present in a list of strings in the ngIf angular directive

This is what I am doing currently but wanted to know if there is a better way of doing it instead of using multiple || expressions.

 <button
            *ngIf="(element.account.status && (element.account.status === 'DRAFT') || (element.account.status === 'PENDING') || (element.account.status === 'REVERT') || (element.account.status === 'REVIEW')); else addDisabled"
            id="add-account" mat-icon-button (click)="openDialog(element.accountType)">
            <img src="../../../../assets/add.svg" />
 </button>
 <ng-template #addDisabled>
            <button id="add-account" mat-icon-button [disabled]="true">
              <img class="intro" src="../../../../svgs/add-disabled.svg" />
            </button>
 </ng-template>

13 thoughts on “What is the efficient way to check if a string is present in a list of strings in the ngIf angular directive”

Leave a Comment