VOOZH about

URL: https://www.geeksforgeeks.org/angular-js/alternative-of-ng-checked-to-get-the-checkboxs-state-in-angularjs/

⇱ Alternative of ng-checked to get the checkbox's state in AngularJS - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Alternative of ng-checked to get the checkbox's state in AngularJS

Last Updated : 15 Jul, 2025

In this article, we will see how to get the state of the checkboxes in AngularJS. This task can be performed with the help of the ng-model directive that helps to bind input, select and textarea, and store the required user value in a variable and we can use that variable whenever we require that value.

Approach:

  • ng-model is used to get the selected checkboxes. 
  • Just set the different values to the ng-model and those will be used to check whether the element is selected or not. 
  • An alert will pop-up for the selected checkboxes with true values. 

Example 1: This example describes getting the state of the checkboxes that are displayed with the help alert message on clicking the button.

Output:

👁 Image
 

Example 2: This example describes getting the state of the checkboxes on clicking the button.

Output:

👁 Image
 
Comment
Article Tags:

Explore