Angular 4 - link values from api to component and template

58 Views Asked by At

In Angular 4 application, I have table with rows. I have to integrate each row with list-view component, so it shows up correctly in webpage. list view component shows status as success - color green, warning - color red ,info - color blue.

<list-view [status]="success"></list-view> 

this returns list view with green color.

but API returns value as Draft,Not Changed, Error. I am not getting how to map values from api to value that template understands.

where data is = "Data":[ {id:1, status:"draft"}, {id:2,status:"Not Changed"},{id:3,status:"Error"} ]

html -

 <ng-container   *ngFor="let data of Data">                       
 <tr style="margin-top: 8px !important;">
<list-view  [status]="{{data.status}}"></adp-list-view>

here status returns as Draft, but i have change it in component to success, so my template works with expected output.

0

There are 0 best solutions below