Change ion-button color based on the dynamic data value

Use Case - Change the button color based on the status coming form an API / data feed. For example: Button is primary if the feed.status is Open. It is success if feed.status is closed and it is danger if feed.status is paused.

Inside my component.ts file -

   feedData: any;
   show="Open";

..... more code that completes the component implementation 

In my component.html file

  <ion-card *ngFor="let feed of feedData">
   <div *ngIf="show == feed.status">
    <ion-item lines="none">
       <ion-button slot="start" color="primary">{{ feed.status }}</ion-button>
    </ion-item>
   </div>
  </ion-card>

The code above doesn’t work. What i really need to do is change the color based on the value stored in feed.status. How do I go about it?

If your feed.status is equal to primary or secondary you could achieve it by setting the variable in the color part, just like this :
<ion-button slot="start" color="{{ feed.status }}">button text</ion-button>

Colors are - primary, secondary, dark, light, warning, danger etc.
Statuses are - Open, Settled, Overdue, Closed, Rejected etc.

Setting the color to feed.status won’t solve it. Need a way to map feed.status values to different colors.

For example - if feed.status == “Rejected” then color=“Danger”, else if feed.status == “Overdue” then color = “Warning”

<ion-card *ngFor="let feed of feedData" [ngSwitch]="feed.status" [routerLink]="[feed.id]">
  <ion-item lines="none">
    <div *ngSwitchCase="'Open'">
       <ion-button slot="start" color="success">{{ feed.status }}</ion-button>
    </div>
    <div *ngSwitchCase="'Close'">
       <ion-button slot="start" color="danger">{{ feed.status }}</ion-button>
    </div>
    <div *ngSwitchDefault>
       <ion-button slot="start" color="primary">{{ feed.status }}</ion-button>
    </div>
  </ion-item>
</ion-card>

Well, where you get your feed.status, you just to have to enum and map the corresponding color into a variable, and use this variable into the color attribute of your button !
This way you don’t need to have a switch with each case in a div, but just one div setting the right color.

Do you have an example code? I looked at enums and found that using it with ngIf or ngSwitch was rather tedious.