![]() |
VOOZH | about |
In this article, we will see how to set checkboxes checked with the click of a button in AngularJS.
Approach: The approach is to use the ng-checked directive to check the checkbox in the DOM. In the first example, a single checkbox is checked by the button and In the second example, multiple checkboxes are checked by the button. The ng-model directive is used to bind the checkboxes.
Example 1: This example describes the implementation of the ng-checked directive to check the checkbox in AngularJS.
Output:
Example 2: This example describes the implementation of the ng-checked directive by specifying the multiple checkboxes to check by clicking the button in AngularJS.
Output: