我想在工厂创建一个功能。但我不明白如何通过我的参数。
如何在参数q中设置动态参数?
app.factory('Item', ['$resource',
function($resource){
return $resource(ApiUrl('items/:id'), {}, {
get: { cache: false },
getWithName: { params: {q: 'tshirt'}, isArray: true, cache: false },
query: { isArray: true, cache: true }
});
}
]);
// Code Sample
$scope.items = Item.getWithName(q:$route.current.params.name);
答案 0 :(得分:0)
$scope.items = Item.getWithName({q:$route.current.params.name});