yalabot / angular-foundation

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

Topbar: Bind variable to see if menu is expanded #268

Open mdedetrich opened 8 years ago

mdedetrich commented 8 years ago

Currently topbar adds/removes a expanded class if you have expanded/closed the menu. Although this is great for really trivial cases, in more complex cases you have to write a custom directive (that uses hasClass) to detect if the menu is opened, and then bind that to a variable

There should be an option for top-bar that lets you bind a variable which represents whether or not the menu has expanded, something like this

<top-bar expanded="someScopeVariable">

Then someScopeVariable will switch between true/false whenever the menu is expanded/closed. After looking at the source, this shouldn't be too hard, it would just involve a = bind and setting the variable in places like https://github.com/pineconellc/angular-foundation/blob/master/src/topbar/topbar.js#L195-L200

jbrowning commented 8 years ago

Happy to accept a PR for this behavior. :+1: