38

The documentation doesn't seem to specify: http://docs.angularjs.org/api/ngResource.$resource

4

1 回答 1

70

query主要区别在于isArray: true

'get'  :  {method:'GET'},
'query':  {method:'GET', isArray:true}

这意味着您将get在请求单个对象和query请求集合时使用。例如:

Users.get({userId:123}); // returns a single user
Users.query(); // returns a collection of all users.
于 2013-10-18T17:44:01.087 回答