I need help with: AngularJS - when checkbox is checked i want to print what i've checked.
Here is the preview. I want to sum those prices when i click on each of them.
Check the jsfiddle
How about this
The main idea is use ng-click to catch which one is checked and sum it up in the mainctrl $scope
app.controller('MainCtrl', function($scope) {
$scope.sum = 0;
$scope.Selected = function (val,smartphone){
if(val){
$scope.sum += parseInt(smartphone.price,10);
}else{
$scope.sum -= parseInt(smartphone.price,10);
}
};
});