I am working with ui-bootstrap accordion. I have an accordion inside an accordion. 
under the 1st accordion 'Category', I have another accordion, with 3 accordion- group. They are closed by default. I would like this behavior: when you click an accordion group title (say 'fruit'), if all the accordion groups are closed, then it will open them all... but if any groups is open( say if any of the 'fruit', 'meat', and vegetable' is open when user is clicking), then when you click, it will toggle the clicked accordion-group. you can check out the plunker here:
http://plnkr.co/edit/UcETfOVh8RwMX40mOCVv?p=preview
my html and angular code is follow:
<!DOCTYPE html>
<html ng-app="plunker">
<body ng-controller="AccordionDemoCtrl">
<accordion >
<accordion-group>
<accordion-heading> Category</accordion-heading>
<accordion ng-repeat="(category, items) in categories" close-others="oneAtATime" is-open="true">
<accordion-group >
<accordion-heading ><div>{{category}}</div></accordion-heading>
<div ng-repeat="item in items.data">{{item}}</div>
</accordion-group>
</accordion>
</accordion-group>
</accordion>
</body>
</html>
angular.module('plunker', ['ui.bootstrap']);
function AccordionDemoCtrl($scope) {
$scope.categories = {
fruit: {
data: {
apple: 3,
orange: 5,
lemon: 6
},
toggled: false
},
vegetable: {
data: {
lettuce: 1,
broccoli: 5,
spinach: 4
},
toggled: false
},
meat: {
data: {
chicken: 3,
beef: 6,
lamb: 8
},
toggled: false
}
};
}
How can I achieve such behavior? I have work progress in another plunker: http://plnkr.co/edit/9eTfpn81g57Dk4FtVSlA?p=preview I've explored with 'is-open' attribute in accordion, I've tried to refered to the $parent, not producing the behavior i want.