-
Notifications
You must be signed in to change notification settings - Fork 3k
Multiple conditions for ui-sref-active #2524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Having this same issue, thought maybe I was using the syntax incorrectly. It looks like it will work with multiple things, but only one of them can have the .* glob. |
Hi, when used with the object literal syntax, That's why only one of the conditions applies. |
+1 |
I'd consider |
Hi! Is there any update on this? It's exactly what we need for our navbar! |
+1 |
+1 no update for this for now, it will be useful ! |
I'd be happy to merge a PR (please add tests around here) ui-router/test/stateDirectivesSpec.js Lines 410 to 415 in 5b54cbf
In the meantime,you can accomplish this with a little bit of shenanigans by nesting hidden <button ui-sref-active="active" class="btn btn-success">
Foo is active
<div style="display: none" ui-sref="foo.**"></div>
</button> See this example: http://plnkr.co/edit/URTdcIWcIgUAqa15PoH2?p=preview |
i.e., <div ui-sref-active="{ active: ['randomState.**', admin.roles'] }"></div> Closes #2524
I am using version 0.2.17 of ui-router.
The problem is that I would like to use the possibility to have multiple rules for ui-sref-active. For example like this:
ui-sref-active="{'active': 'videos.*', 'active': 'files.*'}
Is this somehow possible? At the moment it only takes the last condition.
The text was updated successfully, but these errors were encountered: