0
 <label ng-repeat="option in userlist">
    <input type="checkbox" id="{{option.EntityID}}"/>
        {{option.Name}} <br>
 </label>

How to get multiple selected checkbox id in angularjs array ??

  • What is your problem, what in your posted snipped doesn't work? – Stefan May 17 '17 at 10:27
  • Possible duplicate of [How do I bind to list of checkbox values with AngularJS?](http://stackoverflow.com/questions/14514461/how-do-i-bind-to-list-of-checkbox-values-with-angularjs) – Ramesh Rajendran May 17 '17 at 10:28

2 Answers2

0
<label ng-repeat="option in userlist">
  <input type="checkbox" 
    name="{{option.EntityID}}" 
    id="{{option.EntityID}}" 
    ng-model="option.value">{{option.Name}}<br>
</label>

assuming you can build your data like this

$scope.userlist = [{
  EntityID: 1,
  Name: 'AAA',
  value: false
}, {
  EntityID: 2,
  key: 'BBB',
  value: false
}];

Just use map and get the list of IDs

var selectedIdList = $scope.userlist.filter(function(object) {
  return object.value;
}).map(function(tag) {
  return object.EntityID;
});
Rakesh Chand
  • 3,105
  • 1
  • 20
  • 41
0
<select id="usersavailable" class="on-sel-hide browser-default" ng-model="selectedusers1" size="3" multiple>
    <option ng-repeat="option in userlist" value="{{option.user_id}}">{{option.first_name}} {{option.last_name}}</option>  
     </select>

In controller use:

var selectedUsers     = $scope.selectedusers1;
Kaif Khan
  • 219
  • 6
  • 15