这可能很简单,但我在文档中找不到任何东西,谷歌搜索没有帮助.我正在尝试定义一个状态,$stateProvider我需要在服务器上点击以获取所需数据的URL取决于状态URL参数.简而言之,像:
.state('recipes.category', {
url: '/:cat',
templateUrl: '/partials/recipes.category.html',
controller: 'RecipesCategoryCtrl',
resolve: {
category: function($http) {
return $http.get('/recipes/' + cat)
.then(function(data) { return data.data; });
}
}
})
Run Code Online (Sandbox Code Playgroud)
以上不起作用.我尝试注射$routeParams以获得所需的cat参数,没有运气.这样做的正确方法是什么?