-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Make dropdown menu close on $locationChangeSuccess optional #3683
Comments
Feel free to submit a PR implementing this feature. Although I must say I'm not sure if it will make it into the source since we want to keep the API as simple as possible. Adding very specific settings like this one does not add to that philosophy. |
@rvanbaalen I don't want to introduce new API either. Another option would be included it in the new It's not very intuitive right now: closing on I think it would make more sense to disable this behavior when |
This is an issue not only with the ui-router, but also when using lower level angular APIs such as I like the idea of not closing the dropdown on I'd be happy to submit a PR that fixes this since the dropdown is currently broken for our use case. @rvanbaalen Can you provide some direction as to which interface would be acceptable? |
Disabling this behavior when |
Great thanks for the feedback! I'll submit a PR with this change for |
Awesome! We always appreciate input from the community 👍 |
@rvanbaalen bumping since I'm not sure you guys would have seen a notification come through for the associated PR I submitted awhile back. If you're already aware of it, then nevermind! |
Thanks @CloudNiner. Did miss the PR notification indeed. Will take a look at it this week I hope. |
Great news, thanks! |
As @chrisirhc suggested (#3683 (comment)), it would be good to disable the auto close on location change when As it is, to me, it reads:
Imagine the case (our case) when you have a dropdown with a date picker inside:
These two requirements are incompatible. Similarly, we also have filters inside dropdowns where we would like the same behaviour (add to URL without closing, but close on outside click). Can I suggest changing to: $scope.$on('$locationChangeSuccess', function() {
if (scope.getAutoClose() === 'always') {
scope.isOpen = false;
}
}); I can make the PR if you agree. Thanks. |
I agree that I'd be happy to create a PR for this as well. It would be incredibly helpful! |
@jasonbriggs, we decided that as a library it's better to have users do this themselves and opt-in for this behavior rather than force it on everyone and have them opt-out. |
When ui-bootstrap used together with ui-router, we have a menu like to stay open, while a nested sub state reloads (with url changes) when user click on menu item.
Currently it seems impossible to do this, as dropdown is forced to close upon
$locationChangeSuccess
Would be nice to have something like
close-on-location-change='false'
to make this behavior optional.The text was updated successfully, but these errors were encountered: