1

我正在尝试返回整个列表中的特定项目,如下所示:

exampleFactory.query({'_id': "SOME ID"}, function (item) {
         console.log(item);  //returns all items instead of just one
}

我也尝试取消 .get 但返回错误:TypeError: Object # has no method 'push' at copy

exampleFactory.get({'_id': "SOME ID"}, function (item) {
         console.log(item);
}

这是我正在使用的工厂:

app.factory('exampleFactory', ['$resource',
function($resource){
  return $resource(
    'api/items/:itemId',
    {
      itemId:'@_id'
    }
  )
}]);
4

0 回答 0