如何处理angularjs中的多个复选框

时间:2015-07-07 10:51:58

标签: angularjs checkbox angularjs-ng-model

我有一个复选框列表,它是根据组和项目动态创建的。下面是我用于生成列表的代码。如何使用ng-modal将值保存回db并在编辑过程中如何选中复选框?对不起,如果我还不清楚

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>
<title>Groups</title>
</head>
<body>
<div ng-app="app" ng-controller="myCtrl">
  <table>
    <thead>
        <tr>
            <th> Groups </th>
            <th ng-repeat = "grp in group.Groups" > {{grp.Group}} </th>
        </tr>
    </thead>
    <tbody>
        <tr ng-repeat = "item in items.items">
            <td>{{item.item}}</td>
            <td ng-repeat = "grp in group.Groups">
            <input type="checkbox" >
            </td>
        </tr>
    </tbody>
  </table>
</div>

</body>
</html>

<script>
    var app = angular.module('app', []);

app.controller('myCtrl', function($scope) 
{

  $scope.group = {"Groups":[{"id":0,"Group":"Group A"},{"id":0,"Group":"Group B"},{"id":0,"Group":"Group C"},{"id":0,"Group":"Group D"}]};

  $scope.items = {"items":[{"id":0,"item":"item1"},{"id":0,"item":"item2"},{"id":0,"item":"item3"},{"id":0,"item":"item4"},{"id":0,"item":"item5"}]};


});
</script>

0 个答案:

没有答案