-
Notifications
You must be signed in to change notification settings - Fork 3k
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
feat(uiSrefActive): Also activate for child states. #927
Conversation
Actually no I don't, I don't want to add bloat for no reason which I think I've been guilty of a little bit lately when helping people brainstorm. Let's just get this in and then if we find that people want a special class for when the directive is activated by a child state we'll add it in a new commit. @nateabele, @MrOrz, please review this PR and let's merge it. |
👍 good to go! |
I get: "TypeError: Cannot read property 'name' of null" occuring on line 248 if you have an angular binding as the ui-sref: <a ui-sref="{{ nav.name }}">{{ nav.label }}</a> We should probably have a test in there for that. |
@spaceribs ok thanks, will add that. |
@spaceribs actually there are no tests for that functionality, I'm not sure it was ever expressly supported. Have you ever used interpolation in a ui-sref successfully? |
@spaceribs Yeah, that's not a thing. @timkindberg I dig the functionality, but the directive name is still too verbose for me. What about this? <a ui-sref="state" ui-sref-active="foo" ui-active-child="bar">...</a> |
Well it would have to be named something else because ui-sref-active activates on child so the other one doesn't. I'll think some more too. |
@nateabele @timkindberg I was able to use it before without an error, and it worked fine. Why wouldn't you want to be able to dynamically set the sref? is there a better way? |
@spaceribs its not that I wouldn't want it, its just that it wasn't technically a supported feature and is out of scope for this issue. You can open a new feature request issue once this one is merged though. |
@timkindberg Alright, thanks and sorry for throwing it in to this PR, kinda surprised it wasn't one of the tests already. |
@nateabele so I think it still needs to say |
To limit activation to target state use new `ui-sref-active-eq` directive Breaking Change: Since ui-sref-active now activates even when child states are active you may need to swap out your ui-sref-active with ui-sref-active-eq, thought typically we think devs want the auto inheritance. Fixes #818
@nateabele Ok I shortened it to |
Ya. Googlability.
|
👍 for keeping |
feat(uiSrefActive): Also activate for child states.
I saw 0.2.10 was just released, which didn't include this change. Any idea how long till 0.2.11 is tagged? I tried to bower install sha #5a7c48ca08 but ran into some issues. |
@techniq ouch, yeah... so releases have typically been taking a month. You could cherry pick and build locally. |
@timkindberg - thanks. might just be an issue with my build system. I'll try to re-pull again. I kind of figured the release window was around then, which is why I asked. |
@timkindberg - I figured out why I wasn't seeing the change even after specifying angular-ui-router's version in |
@timkindberg - FYI, I got around the "overrides": {
"angular-ui-router": {
"main": "src/*.js"
}
} |
@techniq ah cool thanks. |
There are several issues opened for this functionality. Which one should I be following? Also what's the proper implementation and timeline for release? Thanks! |
@nateabele when can we expect version 0.3 with this fix? |
+1 for this one. Hate to maintain a local copy of such a basic feature on a project. Fingers crossed for quick release. |
+1. Looking forward to new release. |
+1. Jumping on the bandwagon and eagerly awaiting the next release |
+1. Really need this feature. Looking forward to new release. |
+1 |
3 similar comments
+1 |
+1 |
+1 |
+1024 |
+1 👍 |
Do you guys want this feature? |
+(everyone who uses ui-router) |
@timkindberg yes! i really don't want to use ng-class and $state.includes() to obtain the class. |
+10086 |
+1 |
1 similar comment
+1 |
@timkindberg does this PR still fix this issue? I can't get it to work in my builds, and it doesn't look like the test (at least from the PR's commit) actually tests successful activation of when on a child route. Perhaps I'm missing something? |
+1 |
As there is still no official build including this functionality, I forked You can do the same or use my one by adding following line in your
|
Wasted a bunch of time assuming this was the default implementation to begin with... |
@WD-42 sorry man @mike-marcacci actually I think we realized this only activates for the current and immediate child ui-sref. We'll have to add another PR for all descendant ui-srefs... :( |
Great work on ui-router, a big +1 for this useful feature |
Awesome, this works for me in 0.2.11, thanks. |
Is it gonna cover this case? I have a link in menu that points to |
+1 for what @fxck suggests. |
@fxck @maciej-gurban I've made a proposal for this at #1254 What do you think? |
I'd say this should be opt out rather than opt in, and if opt in, then not by explicitly naming the states. What you proposed is basically the same as using ngclass.. |
+1 |
feat(uiSrefActive): Also activate for child states.
To limit activation to target state use new ui-sref-active-equals directive'
Breaking Change: Since ui-sref-active now activates even when child states are active you may need to swap out your ui-sref-active with ui-sref-active-equals, thought typically we think devs want the auto inheritance.
Fixes #818