yalabot / angular-foundation

http://pineconellc.github.io/angular-foundation/
Other
1.05k stars 267 forks source link

Accordion callbacks #157

Open per-frojdh opened 9 years ago

per-frojdh commented 9 years ago

I was wondering if there's any way to achieve some sort of callback for the opening and closing of the accordion-groups. I tried the vanilla foundation ways, but didn't seem to get very far. Also tried $watching "isOpen", but it seemed to only fire once.

Thanks for all the work you guys put into this, very helpful for new developers like myself.

paramburu commented 9 years ago

I had a similar situation and solved it by attaching an ngClick directive to the accordion-group I needed. The drawback is that it would not get called if it is opened via other methods nor would tell you if it is being closed.

<accordion-group ng-click="myFunction()" heading="title">
    Accordion content.
</accordion-group>
per-frojdh commented 9 years ago

Thanks for the input,

Sadly this also seems to register for all clicks within each accordion-group, specifically I've tried adding a ng-click event on the accordion-heading within each, but this doesn't seem to produce any results (my guess is that there's already some sort of event registered on the header).

For now I'll stick with your solution and see if I can restrict the functions inside the click-event depending on where it was registered.

koosvanderkolk commented 9 years ago

Subscribing

creimers commented 8 years ago

+1