yalabot / angular-foundation

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

Open off-canvas programatically #167

Open matiu opened 9 years ago

matiu commented 9 years ago

Hi Guys! Fantastic job with angular-foundation!

we need to open a off-canvas programmatically (bind to the swipe event of 'ngTouch'). Foundation's off-canvas documentation describe ways to do it (at http://foundation.zurb.com/docs/components/offcanvas.html) but I dont see how to do it using angular -fundation... is there is any way to achieve this?

thanks! pinging @circlingthesun since he submitted https://github.com/pineconellc/angular-foundation/pull/30

circlingthesun commented 9 years ago

You can't do this with the current codebase. There are a couple of ways this could be implemented. I'm not sure what is the most angular/sensible way to do this. One way would be to trigger an open via a service along the lines of offCanvas.open('left'). This works nicely if you only have one off-canvas directive on your page. If you have multiple directives for some reason (on a demo page perhaps), you'd have to somehow distinguish between them (via an attribute maybe), or open them all. @jbrowning thoughts?

ArTiSTiX commented 9 years ago

I also need to control offcanvas programatically.

For the moment, i made my own rewrite of directive, using $broadcast. But i would really appreciate to open/close/toggle/hide offcanvas menus from a service.

mdedetrich commented 9 years ago

Also need to do this on our end due to having multiple menu's for some views