I'm trying to find out how to watch Angular UI's accordion is-open
event so I can have a call back when ever any of my accordions are closed.
This is the basic structure of my accordion's (refined just to show one.)
One thing to note is that these are actually static content, nothings dynamic.
<accordion-group is-open="true">
<accordion-heading>
<h3>Some Header</h3>
</accordion-heading>
<h4>Some pretty awesome content!</h4>
</accordion-group>
My controller
.controller('AccordionDemoCtrl', function ($scope) {
$scope.oneAtATime = true;
$scope.$watch('groups[0].open', function (isOpen) {
if (!isOpen) {
console.log('First group was opened');
}
});
});
Heres a demo
I'm getting the console.log
to fire once upon load, but not when I close any other accordions.
Any ideas? Any help is appreciated.