How to programmatically uncheck checkbox?

user3714598 picture user3714598 · Feb 27, 2015 · Viewed 63.5k times · Source

I want to programmatically uncheck a checkbox. I know how to it in javascript but since I'm using angular, i think it's different.

Here's the link of jsfiddle : https://jsfiddle.net/TKVH6/499/

This is the first time I used jsfiddle so please let me know if you cant see the script and html.

This is the html

<input type="checkbox" ng-model="v" ng-click="checkAll()" />
<button ng-click="x()">eto</button>

This is the angular

$scope.x = function () {
    $scope.v.checked=false;
};

I know there are lots of question like this, I've already tried those but I can't make it work.

Thanks!

Answer

Murali VP picture Murali VP · Feb 27, 2015
<input type="checkbox" ng-checked="v" ng-click="checkAll()" />

In your controller

$scope.v = true; // or false