VOOZH about

URL: https://www.geeksforgeeks.org/angular-js/how-to-set-checkbox-checked-on-button-click-in-angularjs/

⇱ How to set checkbox checked on button click in AngularJS? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to set checkbox checked on button click in AngularJS?

Last Updated : 23 Jul, 2025

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:

👁 Image
 

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:

👁 Image
 
Comment
Article Tags:

Explore