angular-route-segment icon indicating copy to clipboard operation
angular-route-segment copied to clipboard

Problem with resolving segments when switching from 2nd level route: SOLVED

Open Petro-Kashpurenko opened this issue 11 years ago • 2 comments

$routeSegment should be resolved before rendering, other way it will break the router.

file: view-segment.js

$timeout(function(){
  if($routeSegment.chain[viewSegmentIndex])
    update($routeSegment.chain[viewSegmentIndex]);
});

Petro-Kashpurenko avatar Feb 06 '14 10:02 Petro-Kashpurenko

Please describe this a bit more. What use scenario is broken otherwise? Could you please write a unit test for this case?

artch avatar Feb 12 '14 14:02 artch

The problem persists when the application uses, for example #/index/:article and #/static/:page routes. So you have two levels (or more) for each application branch. When route-segment start opening #/static after #/index/:article then we will see #/static/:article an artificial route, because "static branch" could possibly have a second level. So we need to resolve our route segment using, for example $timeout construction. Try to console.log $routeSegment.chain[viewSegmentIndex] approx. 40 line of view-segment.js with application when you have a few long routes, you should see these artificial routes.

2014-02-12 6:50 GMT-08:00 Artem Chivchalov [email protected]:

Please describe this a bit more. What use scenario is broken otherwise? Could you please write a unit test for this case?

Reply to this email directly or view it on GitHubhttps://github.com/artch/angular-route-segment/issues/31#issuecomment-34875425 .

Petro-Kashpurenko avatar Feb 12 '14 15:02 Petro-Kashpurenko