I'm a newbie when it comes to Angular, but, I really want to improve myself and learn, butttt now I have a big big problem.
I don't know how to get the sum for every row I checked ..only for the value entity.
Here you have a plunker with my try code.
https://plnkr.co/edit/iBdEtQU1gPrCSxXQ2yyW?p=preview
Thanks alot !
<table style="border: 1px solid black">
<thead>
<tr>
<th></th>
<th>Id</th>
<th>Name</th>
<th>Address</th>
<th>Value</th>
</tr>
<td><b>Total</b></td>
</tr>
<tbody ng-repeat= "values in getSelected()">
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tbody>
</thead>
</table>
$scope.employees = [
{ id:"1", name: "A", address: "A1", value:10},
{ id:"2", name: "B", address: "A2",value:15 },
{ id:"3", name: "C", address: "A3",value:20},
{ id:"4", name: "D", address: "A4",value:25 },
{ id:"5", name: "E", address: "A5" ,value:30},]
$scope.getSelected = function () {
var ar = $scope.employees.filter(
function (value) {
if (value.checked == 1) {
return true; }
else { return false;
}} );
console.log(ar);
return ar;
};
Aucun commentaire:
Enregistrer un commentaire