Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
46
rated 0 times [  52] [ 6]  / answers: 1 / hits: 27854  / 11 Years ago, wed, august 7, 2013, 12:00:00

I have a list of dynamically filled checkboxes using angular.



 <div ng-repeat=X in XList>
<label>{{X.Header}}</label>
<input type=checkbox name=X value={{X.Item.Id}} />
<p>{{X.Header}}</p>
</div>


I want a method to retrieve a list of all the selected checkboxes.
Usually I'd use



 $('input[name=checkboxlist]:checked').each(function()
{
}


But this is not acceptable with angular .... So is there an appropriate Method to do so?


More From » angularjs

 Answers
4

here is the implemented plunker



 <input type=checkbox ng-model=selected[record.Id]> {{record.Id}}

$scope.ShowSelected = function() {
console.log($scope.selected);
alert(JSON.stringify($scope.selected));
};

[#76481] Tuesday, August 6, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ariel

Total Points: 523
Total Questions: 111
Total Answers: 100

Location: Anguilla
Member since Sun, Jan 29, 2023
1 Year ago
;