Can anyone help me figure out how to pass a particular item from my view to a function in my controller? Here is the code:
The view where I want to pass p.id
<tr ng-repeat=" p in projetsListe">
<td>{{p.NomProjet}}</td>
<td>{{calcul()}}</td>
</tr>
Controller function:
$scope.calcul = function(p) {
var coutprevu = 0;
for (var i=0;i<$scope.task.length;i++) {
if($scope.task[i].projet_id == p.id) {
coutprevu += $scope.task[i].CoutParJour * $scope.task[i].TempsPrevu;
}
}
return coutprevu;
};