Reputation: 53
My application loads a list of objects into a tab, and the user is supposed to click on one of the lines of the tab to choose wich object he wants, and then I will do a request to the server using data specific to the object on the line he clicked.
Here is what it looks like:
https://i.sstatic.net/Ez8tF.jpg
So this tab is generated through a ng-repeat, like so:
<tr ng-repeat="event in eventListCrtl.eventList.eventHead">
<td> <button ng-click="submitEventChoice()">{{event.numeroDossier}}</button>
</td>
<td>{{event.designationDossier}}<br>{{event.nomClient}}
</td>
<td>{{event.adresse}}
</td>
</tr>
I can't get the data through a ng-model since each "td" is repeated.
how can i get the data specific to the line on which the user clicked ?
For example I would like to get the number displayed on the button in my controller so i can prepare my header for my next request to the server.
Upvotes: 0
Views: 44
Reputation: 1158
You can pass in the current ng-repeated item in your ng-click.
ng-click="submitEventChoice(event)"
You can then get the selected event in your controller.
Upvotes: 3