<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 ??
<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 ??
<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;
});
<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;