Multiplication & checkbox value

Hi,

Now I have a little problem with my code.

I have a questionnaire, with radio button answers. Their value is a coefficient. All recorded in Mongodb.

Here is my html code:

<!--réponses-->
    <div ng-repeat="r in q.reponses" class="col-lg-12">
        <div class="radio" data-placement="bottom-left">
            <label class="radio" id="labelRep" for="{{r.coefficient}}">
                <input type="radio" ng-change="updateCounter(r.coefficient)" ng-model="reponseQuestionnaire.userAnswers[r.code]" value="{{r.coefficient}}" id="{{r.coefficient}}" class="custom-checkbox"/>
                    {{r.reponse}}
            </label>
        </div>
     </div>

Whatever I want:

I would like to multiply the coefficients corresponding to the ticked answers.

Do you know a function?

I tried this function in my controller but without success :

$scope.counter = 0;
$scope.updateCounter = function ($event, coefficient, value){
            coefficient = parseInt(coefficient, 10);
            if (value === 0) {
                $scope.counter += coefficient;
            }
            else{
                $scope.counter -= coefficient;
            }

Thank you in advance.

Yours sincerely.

Please note that the techno I use is AngularJS.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.