javascript - How to use two ng-modal in one input type in Angular js? -


i using angular js. , implementing input checkbox, checkbox checked default angular controller using ng-model:

controller:

var checkboxval = true;   $scope.checkboxmodel = {     value : checkboxval,   }   $scope.call = function(){ alert("--comes--");  if($scope.checkboxmodel== false)   {    }   if($scope.mycheckbox== true){    } } 

html:

 <input type="checkbox" ng-model="checkboxmodel.value" data-ng-change="call();"/> 

but when call function "call()" not coming in if condition because $scope.checkboxmodel undefined. when use ng-model="checkboxmodel" coming in if condition true , false. want use both set true value in ng-model="checkboxmodel.value" , compare checkbox value after calling call() function.

you don't need 2 ng-models. change condition since want evaluate based on ng-models value

if($scope.checkboxmodel.value)


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -