是否可以同时打开更多群组。 现在,如果我点击某个组并展开它,其他所有组都会崩溃。 我希望同时看到更多的扩展组。
<accordion>
<accordion-group heading="{{condition.name}}" ng-repeat="condition in conditions" is-open="condition.isOpen" data-ng-click="setCategoryStatus(condition)">
<li ng-repeat="item in condition.items">
<div>{{item.description}}</div>
</li>
</accordion-group>
</accordion>
控制器:
$scope.setCategoryStatus = function (category) {
var index = $scope.conditions.indexOf(category);
$scope.conditions[index].isOpen = !$scope.conditions[index].isOpen;
};
数据:
[
{
"name": "First",
"isOpen":true,
"items": [
{
"id": 1,
"description": "Some desc",
},
{
"id": 2,
"description": "Some desc 2",
}
]
},
{
"name": "Second",
"isOpen":true,
"items": [
{
"id": 1,
"description": "Some desc",
},
{
"id": 2,
"description": "Some desc 2",
}
]
}
答案 0 :(得分:0)
它位于docs,使用close-others
属性,可以是真或假:
<accordion close-others="false">
<accordion-group heading="{{condition.name}}" ng-repeat="condition in conditions" is-open="condition.isOpen" data-ng-click="setCategoryStatus(condition)">
<li ng-repeat="item in condition.items">
<div>{{item.description}}</div>
</li>
</accordion-group>
</accordion>