0

I am working on a web site with Angularjs as my client side platform. I am trying to do what has to be easy and straight forward to do, but for some reason does not work at this time. The code for redirecting is:

      $urlRouterProvider
                .when('/notifications', '/notifications/items');

            $urlRouterProvider
                .when('/notifications/items', '/notifications/items/list');

but it does not work and I end up with the following url:

http://mydomain/#/notifications

here are the states I am using here:

 $stateProvider
                .state('notifications', {
                    url: '/notifications',
                    template: '<notifications-layout></notifications-layout>',
                    data: {
                        requiredPermission: 'notifications',
                        icon: 'suitcase',
                        title: 'send notifications'
                    }
                })
                .state('notifications.items', {
                    url: '/items',
                    data: {
                        title: 'notifications
                    },
                    template: '<ui-view></ui-view>'
                })
                .state('notifications.items.list', {
                    url: '/list',
                    data: {
                        title: 'notifications
                    },
                    template: '<notifications-items></notifications-items>'
                })

I would love to know what am I missing , perhaps someone ran into this issue before?

8
  • can you show your states ($stateProvider)? Commented Feb 20, 2018 at 15:48
  • @Aleksey Solovey sure I've added it to my question thank you!! Commented Feb 20, 2018 at 16:05
  • you have the right code, here is working plunker as an example. Something else is affecting it. Do you have any ideas which part of the code could be doing it? Commented Feb 20, 2018 at 16:21
  • @Aleksey Solovey No I do not know what can be causing this. Do you have any idea what can be the source of this kind of issue? Commented Feb 21, 2018 at 14:51
  • consider adding ui-view into every template like in my example. (In fact to support some older browsers, use <div ui-view></div>) Commented Feb 21, 2018 at 15:04

1 Answer 1

0

I found my answer at the following link: enter link description here

For some reason, on my current project, the order of the $urlRouterProvider and $stateProvider on app.config is important for the UI Router to work...

Sign up to request clarification or add additional context in comments.

2 Comments

is it possible that you have an older version of ui-router (0.2.X)? try updating it to 1.0.X
@Aleksey Solovey my version is: v0.3.1

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.