-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
While updating from ui-router v0.3.0 to v1.0.0-beta.3 I've experience the following issue.
With v0.3.0, I was using view resolves like this:
$stateProvider
$stateProvider
.state('_.shop.search.item', {
url: '/item/{itemId:int}',
views: {
"itemView@_.shop": {
templateUrl: 'templates/shop/shop-item/shop-item.html',
controller: 'ShopItemController',
resolve: {
product: function (server, $stateParams) {
return server["Shop/GetProductDetails"]($stateParams.itemId).then(function (response) {
return response.data;
})
},
productImages: function (server, $stateParams) {
return server["Shop/GetProductImages"]($stateParams.itemId).then(function (response) {
return response.data;
});
}
},
}
}
The ShopItemController looks like this:
.controller('ShopItemController', function ($scope, product, productImages, $anchorScroll, server, $compile, $interpolate, toaster, $stateParams, $state) {
}
After the update, I was getting "Unknown provider: productProvider <- product <- ShopItemController".
I've fixed this by moving the resolve property from the view object to the state object:
$stateProvider
.state('_.shop.search.item', {
url: '/item/{itemId:int}',
resolve: {
product: function (server, $stateParams) {
return server["Shop/GetProductDetails"]($stateParams.itemId).then(function (response) {
return response.data;
})
},
productImages: function (server, $stateParams) {
return server["Shop/GetProductImages"]($stateParams.itemId).then(function (response) {
return response.data;
});
}
},
views: {
"itemView@_.shop": {
templateUrl: 'templates/shop/shop-item/shop-item.html',
controller: 'ShopItemController'
}
}
});
I've figured out how to fix this issue myself, but I guess it would be helpful for others if you could add this issue to the Breaking Changes section of the UI Router migration guide (https://ui-router.github.io/guide/ng1/migrate-to-1_0)
erics2783
Metadata
Metadata
Assignees
Labels
No labels