jtrussell / angular-snap.js

AngularJS directive for snap.js
http://jtrussell.github.io/angular-snap.js/
MIT License
700 stars 67 forks source link

Two drawers to open from the left #103

Closed mileskingston closed 8 years ago

mileskingston commented 9 years ago

Hi,

I was wondering how to specify a button to open a certain drawer on the left.

I have two drawers and two buttons, I tried to attach an ID to the drawer and use this in the snap toggle but that doesn't seem to work.

jtrussell commented 9 years ago

Something like this? https://github.com/jtrussell/angular-snap.js/blob/master/examples/partials/ex-two-snappers.html

Essentially you want to make sure the snap-id you provide to your snap-toggle matches what's on a snap-content. They should both be strings or resolve to strings. Does that answer your question?

mileskingston commented 9 years ago

Thank you for your reply. More like your ex-two-drawers, except both opening from the left. https://github.com/jtrussell/angular-snap.js/blob/master/examples/partials/ex-two-drawers.html

But looking at the example this will probably work. Is there a way to only allow one menu to be open at a time?

jtrussell commented 9 years ago

Not really. Have you considered using a single menu but with variable content? Sounds like that may be a more fruitful than rigging together a system of multiple drawers.

mileskingston commented 9 years ago

Yes that sounds a lot better to me. What would be the best way of doing this? Adding two snap-content elements in side one snap-drawer and specifying them by ID?

jtrussell commented 9 years ago

In essence something like:

<snap-drawer ng-switch="...">
  <my-menu-one ng-switch-when="..."></my-menu-one>
  <my-menu-two ng-switch-default></my-menu-two>
</snap-drawer>

You might have better options depending on what you're using for routing.