I have this HTML http://pastebin.com/DegTb0iH
has a ng-repeat rulling in rullings within it need to do the vote count of each staff, get these values as follows: http://pastebin.com/EB4KigwS
the problem is there on the lines 17,18 and 19 HTML, totalVotes always returns 0 in JS (or only the last result), if you do the console.log in the success comes the correct result of each type of vote
Can anyone give me a help?
You're calling the function three times using a different value for
voto_type
(fair enough) but all three of these, on the success callback, will store the result in$scope.totalVotes
which means they will always display the same and last result.You need to store each result into a separate $scope variable.
E.g. JS:
and HTML: