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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -