Ng-repeat and ng-click in the same tag
I just searched for the same problem but couldn't find a solution. I tried some solutions and examples but nothing worked.
I have this HTML in AngularJS:
<h2 class="text-center text-thin">{{pageTitle}}</h2>
<input type="text" ng-model="searchText" placeholder="Search" class="center-block" />
<div>
<br>
</div>
<div class="list col-xs-12">
<table class="tbl-catalogo">
<tr class="even">
<td>Article</td>
<td>Family</td>
<td>Ice Type</td>
<td>Cooler</td>
</tr>
<tr ng-class-odd="'odd'" ng-class-even="'even'" ng-repeat="prod in list | filter:searchText" ng-click="_dettaglio3(prod);">
<td>{{prod.id_a}}</td>
<td>{{prod.id_f}}</td>
<td>{{prod.forma}}</td>
<td>{{prod.tipo_raff}}</td>
</tr>
</table>
</div>
And in my controller, I have this function:
$scope._dettaglio3 = function (val) {
alert(JSON.stringify(val));
console.log("\n\n\n\n\n\n" + JSON.stringify(val) + "\n\n\n\n\n\n");
};
Problem: When I click the button tr
the first time, when it fixes, when I click the second time, the first passed item is the first if I click one more time when the item passed correctly. How can I solve this problem?
+3
source to share
No one has answered this question yet
Check out similar questions: