1

I want to select/deselect child check boxes based on parent check boxes i need this in angularjs anyone please give the solution

i want like this

enter image description here

1
  • Please provide code that you worked on Commented Jan 5, 2016 at 9:23

1 Answer 1

1

The ng-checked attribute in the checkbox takes in an expression. So you can give an expression with and/or conditions, as mentioned below to make it checked based on an expression.

<input type="checkbox" ng-checked="child_1 && child_2 && child_3 && child_4 && child_5" ng-model="parent"/> Select All<br/>

You dont have to write a seprate function to do the computation when every child checkbox is clicked.

In above example Child Check box model: child_1, child_2, child_3, child_4, child_5
Parent Check box model : parent
Example

Sign up to request clarification or add additional context in comments.

3 Comments

I want parents have multiple checkboxes
have you see example provided link ?
yes my childs data came from api i will use ng-repeat to display th child checkboxes and parent checkboxes also

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.