ui-router-extras stateParams empty

109 views Asked by At

can anyone help me on this I have got a question about params:

1) when I go to app.usermanagement.user({id:40}) in router.config in resolve function $stateParams is empty. I guess I missed some option.

I'm going to that state by ui-sref="app.usermanagement.user({id:40})"

Here is code below:

var states = [];

states.push({
    name: 'app',
    url: '/',
    deepStateRedirect: true,
    resolve: {
        languages: function (CommonData) {
            return CommonData.getLanguages();
        },
        r1s: load([
            'ui.select'
        ]).deps
    },
    views: {
        '@': {
            templateUrl: 'tpl/app.html'
        }
    }});
states.push({
    name: 'app.usermanagement',
    url: 'userManagement',
    templateUrl: 'app/views/user-managment.html',
    controller:'UserManagmentController',
    deepStateRedirect: { default: "app.usermanagement.search" }
});
states.push({
    name: 'app.usermanagement.search',
    url: '/search',
    templateUrl: 'app/views/tabs/user-managment/user-search.html',
    controller:'UserSearchController'
});
states.push({
    name: 'app.usermanagement.user',
    url: '/user/{id}',
    controller:'UserPageController',
    templateUrl: 'app/views/tabs/user-managment/user-page.html',
    resolve: {
        user: function ($stateParams, UserData) {
            return UserData.getUserById($stateParams.id);
        }
    },
    deepStateRedirect: { default: "app.usermanagement.user.details" }
});
states.push({
    name: 'app.usermanagement.user.details',
    url: '/details',
    controller:'UserDetailsController',
    templateUrl: 'app/views/tabs/user-managment/user-details.html'
});
states.push({
    name: 'app.usermanagement.user.friends',
    url: '/friends',
    templateUrl: 'app/views/tabs/user-managment/user-friends.html'
});
1

There are 1 answers

1
Georgi Gevorgyan On BEST ANSWER

ok I was missing property params:true in deepStateRedirect object

deepStateRedirect: { default: "app.usermanagement.user.details", params:true }