How do i check checkbox which has value of for example 5 with angularjs.
I am getting JSON with all values of checkbox that needs to be checked , but i cant find anywhere how to automaticaly check checkbox with value of , with angular js.
How do i check checkbox which has value of for example 5 with angularjs.
I am getting JSON with all values of checkbox that needs to be checked , but i cant find anywhere how to automaticaly check checkbox with value of , with angular js.
You can use the ngChecked directive for checking and unchecking a checkbox
Also if you want for example to set a checkbox to checked when the value is 5:
<input type="checkbox" ng-model="checkbox_model" ng-checked="data.value=='5'"/>
Try something like this :
HTML
<input type="checkbox" ng-model="selectedAll" ng-click="checkAll()" />
CONTROLLER
$scope.checkAll = function () {
if (!$scope.selectedAll) {
$scope.selectedAll = true;
} else {
$scope.selectedAll = false;
}
}
Add this code to your controller and HTML this will definately help you