html - How to add the background-color for data in table using bootstrap-classes and angularjs? -


i want small e-commerce application. after done order user, admin got orders , order item consist of order id, itemname, price, status, btnclass.

default status of order pending , value of btnclass label-warning, after editing order pending delivered value of btnclass change label-success. don't know how this

btnclass storing bootstrap class.

<table>     <th>order id</th>     <th>item name</th>     <th>price</th>     <th>status</th>     <th>total</th>     <tr ng-repeat="item in orders">         <td>{{item.orderid}}</td>         <td>{{item.itemname}}</td>         <td>{{item.price}}</td>         <td><p class="label {{list.btnclass}}">{{item.status}}</p></td>         <td>{{item.total}}</td>     </tr> </table> 

my array this:

[     {         "orderid":1,         "itemname":"rice",         "price":10,         "status":"pending",         "btnclass":"label-warning",         "total":10     },     {         "orderid":2,         "itemname":oils,         "price":50,         "status":"deliverd",         "btnclass":"label-success",         "total":50     } 

please me how provide classes table data..

ng-class useful that. can create 2 css classes status, example .delivered or .pending. , use ng-class directive such :

<td><p ng-class="{'deliverd' : item.status === 'delivered', 'pending' === 'item.status === 'pending'}">{{item.status}}</p></td> 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -