将所有组传递给单个组控制器并折叠除选定组之外的所有扩展组的想法
查看html:
<tbody ng-repeat="group in $groups | orderBy:'value'" sortable="'sortletter'"
ng-controller="groupCtrl">
<tr class="ng-table-group">
<td colspan="{{$columns.length}}">
<a href="" ng-click="switchGroup(group, $parent.$groups)">
组控制:
app.controller('groupCtrl', function($scope) {
//console.log($scope);
$scope.group.$hideRows = true;
// console.log("scope.group.$hideRows"+$scope.group.$hideRows);
$scope.switchGroup = function(group, groups){
if(group.$hideRows){
angular.forEach(groups, function(g){
if(g !== group){
g.$hideRows = true;
}
});
}
group.$hideRows = !group.$hideRows;
};
});
普朗克