I have implemented a basic HTML table using AngularJS to display data for each item in my "names" array. Each item represents an object with various attributes such as Name, id, etc. Along with each row in the table, I have included a button. However, I am unsure of how to determine which button has been pressed and retrieve its associated value. For instance, if there is a row displaying Name: Michael, id: 1, and a corresponding button, when that button is clicked, I would like to capture the id: 1 into a variable within my app controller.
HTML code
<ul>
<li ng-repeat="x in names | filter: name">
<div id="kartei">{{ x.artikelName }} {{ x.artikelBeschreibung }} {{ x.artikelPreis }} {{ x.angebotNummer }} {{ x.kundenMail }}</div>
<div id="Kaufen" ng-app="myApp" ng-controller="angebotKaufen">
<button ng-model="kaufbutton" type="button" ng-click="submit()" ng-value="{{ x.angebotNummer }}">purchase {{ x.angebotNummer }}</button>
</div>
</li>
</ul>
JavaScript
app.controller("angebotKaufen", function($scope){
$scope.submit = function(){
console.log($scope.kaufbutton);
// Logic for purchasing
// Retrieve id information from database
// Redirect to purchase page
};