J
J
JusticeArt2017-11-28 12:49:31
Angular
JusticeArt, 2017-11-28 12:49:31

AngularJS how to make unique buttons in ng-repeat?

Hello everyone, I continue to comprehend zen with AngularJS. The problem is the following, I have a list of orders at the end of each order, there is an order status button, everything looks like this.
ANdPy.png
When the state of one order changes, all buttons change. The question is how to identify the button, with the following markup code

<tr ng-repeat="product in admin.listProduct">
    <td>{{product.name}}</td>
    <td>{{product.email}}</td>
    <td>{{product.amount}}</td>
    <td>{{product.price}}</td>
  <td ng-switch on="admin.flag">
  <button type="button" ng-switch-when="0" ng-click="admin.flag=1" class="btn btn-success">Confirm</button>
  <button type="button" ng-switch-when="1" ng-click="admin.flag=2" class="btn btn-primary">Send</button>
  <button type="button" ng-switch-when="2" ng-click="admin.delete(order)" class="btn btn-danger">Complete</button>  
    </td>

The flag value is stored in the controller.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question