-
Notifications
You must be signed in to change notification settings - Fork 100
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
add 'routeSegmentChangesSuccess' event (when all segments are updated) #5
base: master
Are you sure you want to change the base?
Conversation
…nt updates are done (this is also the time when $routeSegment.name reflects the newest segment name)
I'm updating the tests... |
@hupf Interesting scenario. I didn't think about the possibility to use
Have you checked https://github.com/artch/angular-route-segment/blob/master/src/route-segment.js#L350-L354 |
@artch We don't have to use third-party views, that the really nice thing about your project. We can just style the normal
It's great, I don't know any other router that can do this :-)
Yes I did. The problem with it is that there are multiple events and one doesn't know which segment is the currently loaded (i.e. corresponds to the current route). I think equivalent to ngRoute's |
@hupf Well, an important thing here is that wrapping I admit that it would be helpful to have the single event confirming all the segments are done. However, it should not provide any event arguments (because there are no particular segment linked to the event, and segments could be accessed via If you amend your PR like that, I would be happy to merge it. |
@artch You're right about wrapping About the event: I'd strongly suggest to also add a What do you think? |
|
Hi, I am new to angularjs. I am using your angular-route-segment for nested tabs layouts. I am not sure how to code the refresh for your page adding in a confirm popup, "are you sure you want to navigate away from this page?" I'd like to use this on reload and logut. I tried to use a listener in the event, $routeUpdate ($scope.$on("$routeUpate", function() confirm("are you ....")) and that did not work. I tried a listener on $stateChangeStart and that did not work. The event $routeChangeSuccess does not seem to be the right one to use since I am not changing the route segment. I like to reload in case 1 and close the window in the second case. Can you provide some direction for me? Thanks. |
Hi guys, I vote for this feature... my case:
in controller of the "base": $scope.$on('routeSegmentChange', function() {
$scope.activeSegment = $routeSegment.name;
}) in template of the "base": <a ng-href="#{{ activeSegment | routeSegmentUrl}}"></a> in navbar template: <a ng-href="#{{ 'base.foo' | routeSegmentUrl}}"></a> So when i stay in "base.bar.baz" and click link in navbar(go to "base.foo") |
Hi Artem
Thank you for the great work. The segment router looks really promising and fits well for our scenario. We are building a mobile web app where – instead of side-by-side segments – we use the segments as layers.
E.g. if the user scolls down a long list (list-segment), then opens an entry (entry-segment), we store the scroll position and hide the list-segment such that only the entry-segment is visible. When he gets back to the list, we restore the scroll position such that the user is at the exact same spot as before.
For this I have to know the name of the current segment in the 'segmentChange' event. That's why I've added a 'routeSegmentChangesSuccess' event, that gets fired when all the segments have been updated. I think this might be useful for other scenarios as well and is the complement to the '$routeChangeSuccess' event of ngRoute.
If you're willing to support the "layer" scenario with the segment router, we might also try to integrate some of our (yet ongoing) work we're doing to get this running.
Mathis