Angular UIRouter does not change with child state

I use Angular UIRouter and set the following states:

$stateProvider.state('forgot-password', {
        url: '/forgot-password',
        component: 'forgotPassword'
})
.state('forgot-password.reset', {
        url: '/:token',
        component: 'forgotPasswordReset'
});

When I go to /forgot-password, I get the correct view, but when I go to /forgot-password/abc, I still get a link to forgotPassword. How to make the router send me state forgot-password.reset?

+4
source share
1 answer

There are several different reasons why this can happen. Above my head:

  • You do not have a directive ui-viewin the template for your component forgotPassword.
  • One or both components are not registered (but you should see errors in the console, if so).
  • URL-, .
  • . , redirectTo - , .

UI Router , , , . , , - .

+4

Source: https://habr.com/ru/post/1682367/


All Articles