sovanna / angular-material-sidenav

Simple component that reproduce the Angular Material Style SideNav Menu from their own website
http://sovanna.github.io/angular-material-sidenav/
109 stars 55 forks source link

Maintaining menu selection for multiple or child states #4

Closed 7omw closed 8 years ago

7omw commented 8 years ago

This is great thank you! It saved me heaps of time I would have head to spend to make my own version of this.

I have a set of states which I want to all be grouped under a single sidenav link. Clicking the link should open up the primary state, but I would like it so that when any of those states are loaded that menu link is selected.

At the moment if my menu link is "Customers" and clicking it loads the customers state (/customers), and then clicking on a customer entry loads the customers.edit state (/customers/1) the menu link will still be selected, but if I refresh the page (loading url /customers/1) the sidenav will load in an unselected state, when I would like the Customers menu link to still be selected.

It would be ideal if we could define a single action-state and an array of selection-states for each link, such that the action state is used when the link is clicked but the selection-states are used to determine when the link will be selected/highlighted.

sovanna commented 8 years ago

Hi! thanks for this! I appreciate, sorry to not respond to you before, .. didn't see the notification.. too many maybe.. have to clean a bit my account.. ;)

anyways, for your problem, I've got an idea, I can use the "$state.includes('primary state')" and if the "substate" is in the primary state, the item will be selected.