circlingthesun / angular-foundation-6

Foundation 6 directives for Angular 1.5+
http://circlingthesun.github.io/angular-foundation-6/
Other
95 stars 50 forks source link

Accordion events #50

Closed darrenkeenn closed 7 years ago

darrenkeenn commented 7 years ago

Hi,

Is there a way to catch when an accordion title has been clicked open/close it?

Thanks, Darren.

circlingthesun commented 7 years ago

Not as far as I recall. I imagine emitting an event could be useful. PRs are welcome ;)

darrenkeenn commented 7 years ago

Thanks for getting back to me.

I found this: https://github.com/circlingthesun/angular-foundation-6/pull/31/commits

Not sure if this is what I need...sounds pretty similar but insure how this can be used.

Thanks, Darren.

darrenkeenn commented 7 years ago

Didn't mean to close! Ha

circlingthesun commented 7 years ago

Ha, yes, I forgot about that PR. So basically, in Angular events propagate up from child scopes to parent scopes. So you can listen for that event in any parent scope or on $rootScope via the $on() function on the scope. Have a look at https://toddmotto.com/all-about-angulars-emit-broadcast-on-publish-subscribing/

circlingthesun commented 7 years ago

So you'll need to listen for 'down.af.accordionGroup' and 'up.af.accordionGroup'.

darrenkeenn commented 7 years ago

That's perfect. Thanks very much. P.S love the repo!

....And I actually mean to close this now!