1

I have those 2 states for my page :

$stateProvider
    .state("page", {
        url: "/:pageId/:pageType",
        template: pageTemplate,
        controller: "contentCtrl",
        resolve: {
            ...
            }
        },
        params: {reload: true}
    })

and

.state("schedule", {
        url: "/Schedule/:scheduleId/:pageId/:pageType",
        template: pageTemplate,
        controller: "contentCtrl",
        resolve: {
            ...
            }
        },
        params: {
            pageId: { squash: true, value: null},
            pageType: { squash: true, value: null},
            reload:true
        }
    })

SOMETIMES, for link's like this :

http://localhost:8182/index.html#/Schedule/691d6981b8dd47e0a158d67cb02b1fee/

the 'page' state is loading instead of the 'schedule' one.

What should I do to fix this?

PS: I'm using AngularJS v1.7.6 and ui-router v0.2.18

1 Answer 1

1

The routes are matched in the order they are defined. However, exact matches take precedence over parameterized matches.

I would at first try to change the order of the states.

then I would try to do something like

$stateProvider.state('foo.bar', {url: '/foo/:bar'});
$stateProvider.state('foo.baz', {url: '/foo/baz'});
$urlRouterProvider.when( '/foo/baz', function($state){ $state.go('foo.baz'); } );

Also I see two problems:

  1. what's with that uppercase in /Schedule/
  2. what's with params: {reload: true}"
Sign up to request clarification or add additional context in comments.

4 Comments

it's just one more place where it could go wrong. (I wouldn't do it)
i've tried with your suggestions and the result is the same
try to see what happens when you remove the "page" state
then it's not a state problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.