现在,我的代码有点问题。乘法&复选框的值
我有一个问卷,单选按钮的答案。它们的值是一个系数。全部记录在Mongodb中。
这里是我的html代码:
<!--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>
我想做的事情:
我想乘以对应勾选答案系数。
你知道一个函数吗?
我在我的控制器,但没有成功尝试这个功能:
$scope.counter = 0;
$scope.updateCounter = function ($event, coefficient, value){
coefficient = parseInt(coefficient, 10);
if (value === 0) {
$scope.counter += coefficient;
}
else{
$scope.counter -= coefficient;
}
预先感谢您。
此致敬礼。
请注意,我使用的技术是AngularJS。
好吧,谢谢你..!和功能?你有好主意吗 ? – Nadjeem
@Nadjeem有什么功能? – Exlord
进行处理,有什么功能?它包含什么?如果我删除参数中的“值”,我有“价值没有定义”... – Nadjeem