Answer the question
In order to leave comments, you need to log in
Correct way to bind checkbox-group like array of arguments with ng-model?
Hello.
In fact, how would it be most correct to pass to $scope.query.skills = [] the values of the group of checkboxes that will be formed using PHP tools.
How about ng-model="query.skills[INDEX_OF]" ?
Maybe using ng-change="setValue($element)" ?
Is there any other suitable way?
Answer the question
In order to leave comments, you need to log in
In the case of ng-model, you will need a hash. Like this:
query.skills = {
1: true,
2: false
};
<input type="checkbox" ng-model="query.skills[1]"/>
<input type="checkbox" ng-model="query.skills[2]"/>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question