lundi 23 janvier 2017

checkbox handling in angularjs

I have a table with checkboxes. Initially I had radio buttons so I was using the ng-model to pass the row data to the backend. But now I changed them to checkboxes, and I can still save the selected rows in an array or as a Json; But the backend is designed to handle one table row at a time only. I cannot send an array of rows.

I thought of using a loop to send each row separately, but I am not sure how to do it. Please help.

This is my html

<tr
    ng-repeat="row in MyApp.currency track by $index">
    <td><input type="checkbox" value="" name="check" title="Select the tags to submit or delete"></td>
    <td style="padding: 10px;"></td>
    <td style="padding: 10px;"></td>
    <td><button type="button" class="btn btn-sm btn-primary"
                    ng-click="MyApp.openlottery($index,row)">
                    <i class="fa fa-edit "></i>
        </button></td>
</tr>

I need the lotterycode and valuess of the row selected to be sent to the backend; one row at a time.

Help will be appreciated.




Aucun commentaire:

Enregistrer un commentaire