如何获取选定行数据AngularJS

如何获取选定行数据AngularJS,angularjs,checkbox,angularjs-ng-repeat,Angularjs,Checkbox,Angularjs Ng Repeat,我正在尝试从AngularJS中的表中获取选定的行,但不知道如何做到这一点。下面是我所做的一切 http://plnkr.co/edit/APb0MeK5th7z79l32SEy?p=preview 代码Html <body ng-controller="MainCtrl"> <table> <tr><td>Select Column</td><td>id</td> <td>name</t

我正在尝试从AngularJS中的表中获取选定的行,但不知道如何做到这一点。下面是我所做的一切

http://plnkr.co/edit/APb0MeK5th7z79l32SEy?p=preview
代码Html

 <body ng-controller="MainCtrl">

<table>
<tr><td>Select Column</td><td>id</td> <td>name</td> <td>address</td> <td>classA</td> <td>classB</td></tr>  
<tr ng-repeat="employee in employees">
    <td><input type="checkbox"></td>
    <td>{{employee.id}}</td>
    <td>{{employee.name}}</td>
    <td>{{employee.address}}</td>
    <td><input type="checkbox" ng-model="employee.classA"></td>
    <td><input type="checkbox" ng-model="employee.classB"></td>
</tr>
</table>
<input type="button" name="save" value="submit">
我想要用户在单击提交时从左列复选框中选择的行


非常感谢您的帮助。

您应该将此复选框绑定到模型,就像您对classA和classB所做的那样

例如:

<td><input type="checkbox" ng-model=employee.selected></td>

检查


绑定复选框后,我应该做什么?我需要循环吗?我只需要选定的员工,就像我选择1和3一样。
<td><input type="checkbox" ng-model=employee.selected></td>
<td><input type="checkbox"
       ng-model="employee.checked"
       ng-true-value="1" 
       ng-false-value="0"></td>
<button ng-click="getSelected()">getSelected</button>
$scope.getSelected = function () {
  var ar = $scope.employees.filter(
    function (value) {
      if (value.checked == 1) {
        return true;
      } else {
        return false;
      }
    }
    );

  console.log(ar);
};