JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app ng-controller="myCtrl">
<h1 ng-repeat="x in lista">
<td>
<input type="checkbox" name="selector" value="{{x.id}}">
</td>
<td>{{x.text}}</td>
</h1>
<button ng-click="getCheckedValues()">
Click
</button>
<h2 ng-repeat = "y in checkedValue">
{{y}}
</h2>
</div>
JavaScript
function myCtrl($scope) {
$scope.lista = [
{id:0,text:"zero"},
{id:1,text:"one"}
]
$scope.checkedValue = [];
$scope.getCheckedValues = function(){
var checkboxes = document.getElementsByName("selector");
// loop over them all
for (var i=0; i<checkboxes.length; i++) {
// And stick the checked ones onto an array...
if (checkboxes[i].checked) {
$scope.checkedValue.push(checkboxes[i]);
}
}
// Return the array if it is non-empty, or null
// return $scope.checkedValue.length > 0 ? $scope.checkedValue : null;
}
}