-
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
calling previous controller #27
Comments
If iam not wrong this issue is because the app-view-segment chain isnt flushed before a route change instead it is incrementally substituted which causes this issue. It would be great it this was fixed, cause this causes a lot of nasty issues. Edit: Just found a fix for it #7 |
I am also getting the same problem .. here is my plunkr http://plnkr.co/edit/VPFOi7?p=preview Please check console.logs to see the error Here is the hierarchy /listing ( cntrller :- listing_index ) Initially the default url is /listing/myListing so it calls the following controllers ( listing_index,my_listing ) Now on clicking a link which takes to /promotion/list the following controllers are called ( promotion_index, my_listing, promotion_list ) why is my_listing getting called again ?? Please check console for the errors |
+1, this should not be happening! Compare if ($route.current.$$route.segment === $routeSegment.name) {
//do stuff that should only happen when the
// *correct* segment is being initialized
} PS: angular-route-segment v1.2.0 |
@jamie-pate that controller should never fired. |
@naczu It is fired though :) PS: this workaround only works for controllers that are used in the right-most segment. EG: route: x.y.z <- code only works in controller for z |
Ok, so. I figured out the 'correct' workaround for my problem. The issue for me was caused by calling $location.path(newPath) inside the constructor for a controller in one of the routes. I was also mixing $routeProvider and $routeSegmentProvider and angular-route-segment wasn't updating the $routeSegment properly when the route wasn't a segment! The solution was to not mix $routeProvider and $routeSegmentProvider |
+1 .Suffering form the same issue . @jamie-pate do you have a plunkr to illustrate your solution ? |
If you have a plunkr to illustrate your problem, I might be able to fix it? |
Hi @jamie-pate , will this do :- http://plnkr.co/edit/VPFOi7?p=preview |
That plunkr seems to work fine (no error messages) It seems like $routeProvider is needed for redirects? I needed dynamic redirects so I ended up having to create a controller that did the job
|
Hi. This is really great lib. I started to use angular-route-segment for nested views. But I have a problem. When I route to another segment, it calls previous controller. Here is you can see my problem
http://plnkr.co/edit/VUZM1ts5GvLnC2nf6QLe?p=preview
I would be grateful if you have a solution for this.
http://stackoverflow.com/questions/19978291/angular-route-segment-calls-previous-controllers
The text was updated successfully, but these errors were encountered: