I'm facing a need to display a sum of values (related to $scope
variables) depending on the selection of flags. For instance:
- There are 4
$scope
variables (e.g.$scope.Var_1
,$scope.Var_2
...) containing integer values, - There are 4
$scope
variables (e.g.$scope.Var_1_Flag
,$scope.Var_2_Flag
...)containingtrue
orfalse
for each of the above integer variables.
So, in we have:
$scope.Var_1 = 1 ;
$scope.Var_2 = 2 ;
$scope.Var_3 = 3 ;
$scope.Var_4 = 4 ;
$scope.Var_1_Flag = true ;
$scope.Var_2_Flag = true ;
$scope.Var_3_Flag = true ;
$scope.Var_4_Flag = true ;
then 10
will be displayed, but if:
$scope.Var_1_Flag = true ;
$scope.Var_2_Flag = false;
$scope.Var_3_Flag = false;
$scope.Var_4_Flag = true ;
then 5
will be displayed.
Does AngularJS support a binding syntax that would realize this?