title: How do I reverse a checkbox state to make it unchecked (AngularJS)?
body: <p>I basically want that when the user clicks on a checkbox, their decision is immediately reversed and the checkbox is unchecked. The code below is not working. I tried other variations like value = !value instead of value = false and tried initializing another controller variable to be equal to the checkbox variable and changing the other controller variable. None of this works; basically, I cannot set the checkbox state unless the application is first being initialized.</p>
  
  <p>HTML code:</p>
  
  <pre><code>&lt;input type="checkbox" ng-model="avariabledefinedincontroller" ng-click="changemystate(avariabledefinedincontroller)"&gt;
  </code></pre>
  
  <p>Controller code:</p>
  
  <pre><code>$scope.avariabledefinedincontroller = false;
  
  
  $scope.changemystate = function(value){
    if (value == true) {
      value = false;
  
   }
  
   else {
     value = value;
   }
  
  };
  </code></pre>