Similar to how tabs have an active class depending on if they are active or not, is this possible to do when using the side menus?
So my content pane has nav-view which will populate the data associated with the links from the side-menu.
I did some digging with the dev tools and saw that there is no active class being applied to the links in my menu, but there should be.
Has anyone accomplished this before or know of how to go about implementing this? Seems like this should be a built in feature to the side menu in my opinion.
<side-menus>
<!-- Center content -->
<pane side-menu-content>
<nav-view name="content"></nav-view>
</pane>
<!-- Left menu -->
<side-menu side="left">
<list>
<item ng-repeat="item in items"></items>
</side-menu>
</side-menus>
Maybe it shouldn’t be as complicated as this but, you could use a directive on each side menu item. Then a controller/service to keep only one active at a time.
See this. Fascinating read but very complex. It’s how the Angular-UI folks manage to keep only one tab or dropdown open at a time:
Nice Andy. I’m so glad you joined the Drifty team. It was great before but with another great mind in the mix (and more manpower), Ionic is really going to take off.
@andy, sorry for no responding right away, had a few other things that required my attention before this. I went to implement this but where I’m running into trouble is with the href attribute. In you’re example, your href is defined somewhere in the model.
But in my case, I’m making my href by passing in other attribute in the model.
So I guess it was much simpler that I thought. I changed my links to use UI-Routers ui-sref instead of just ng-href. This lets you watch for which link is clicked based out the states the parameters you pass to it.
To get around this issue i created my own class current. By checking the code, I found that active class is getting added to active elements and then its getting removed. Why they don’t use pseudo-class active?
I see the ui-sref-active working ok but if you use an ion-item the background with a darken 10% is not applied because the link inside has a background too, set to the specific color.