app.config(['$stateProvider', function ($stateProvider) { $stateProvider.state('home', { url: '/', template: '' }).state('editDepartment', { url: '/edit/department/:id', controller: 'departmentCrudController', templateUrl: '/items/department/editform' }).state('editCategory', { url: '/edit/category/:departmentId/:categoryId', controller: 'categoryCrudController', templateUrl: '/items/category/editform' }).state('editItem', { url: '/edit/item/:departmentId/:categoryId/:itemId', controller: 'itemCrudController', templateUrl: '/items/item/editform' }).state('newDepartment', { url: '/new/department', controller: 'departmentCrudController', templateUrl: '/items/department/editform' }).state('newCategory', { url: '/new/category/:departmentId/:departmentNameHash', controller: 'categoryCrudController', templateUrl: '/items/category/editform' }).state('newItem', { url: '/new/item/:departmentId/:categoryId/:departmentNameHash/:categoryNameHash', controller: 'itemCrudController', templateUrl: '/items/item/editform' }); }]);and then in the CategoryController code I have
var init = function () { $scope.showForm = false; $scope.disableAction = false; $scope.isEditLoading = false; load($stateParams.departmentId, $stateParams.categoryId, $stateParams.departmentNameHash); };and in the ItemController I have
var init = function () { $scope.showForm = false; $scope.disableAction = false; $scope.isEditLoading = false; $scope.gridOptions = []; load($stateParams.departmentId, $stateParams.categoryId, $stateParams.itemId, $stateParams.departmentNameHash, $stateParams.categoryNameHash); };In the category controller the $stateParams.departmentNameHash is correctly defined. But in the Item Controller both departmentNameHash and categoryNameHash are undefined and I can not figure out why is that and what is missing.