mardi 9 mai 2017

AngularJS Need to bind parent checkbox with child without using ng-model

I got an User list using ng-repeat via a API call. For every User their is 5 categories and each category got 2-3 authorizations on true/false.

For every user/category/authorization I want a checkbox that will change the value of authorization.

When I check the checkbox of an User I want all his 5 categories + all the authorizations been check true and if I uncheck one authorization or categories of an User his checkbox will go false.

So if I recapitulate: their is a parent(User), child(Category) and grand child(Authorization).

I saw that we can use ng-model with ng-checked but in my checkbox the ng-model is used for the boolean authorization (ng-model="authorization.Enabled") and for more than 1 child this no more work.

How can I manage this case ? Need a $watcher ?

Thanks for your help !




Aucun commentaire:

Enregistrer un commentaire