javascript - Add a number only when a radio button is selected -
i want add number total amount based on radio button select if user selects radio button value = "serfeeadd"
need check it, , add total can't figure out why not working when remove scope = this
, use $scope
directly kinda works, need value assigned variable.
i trying build magento wristband designer app built stuck part .
the code has been modified provide guys overview more can let me know.
var app = angular.module('wdwristbanddesigner', []); app.controller("fontctrl", maincontroller); function maincontroller($scope){ //scope var scope = this; scope.foo = function(){ if (scope.serialisationfeecheck == 'serfeeadd') { scope.serialisationfee = 10; console.log(scope.serialisationfeecheck); } else { scope.serialisationfee = 0; }; } };
<section class="wd-section" ng-controller="fontctrl fs"> <input type="radio" name="serialno" data-ng-model="serialisationfeecheck" value="no" >no <br> <input type="radio" name="serialno" data-ng-model="serialisationfeecheck" value="our">yes(our choice) <br> <input type="radio" id="chk" name="serialno" data-ng-model="serialisationfeecheck" value="serfeeadd" >yes(your choice) <button typ="button" ng-click="foo()" >click</button> </section>
ng-click should fs.foo() , of ng-models need fs object applied them.
Comments
Post a Comment