I found very strange behavior of Angular $resource. Please checkout following lines of code:
class Service
constructor: ($resource) ->
service = $resource '/record/:id'
Service::list = (cb) ->
service.query().$promise.then (data) ->
#result: data == [e, $promise: Object, $resolved: true]
cb data
Service::get = (id, cb) ->
service.get(id:id).$promise.then (data) ->
#result: data == {id: 1, name: 'name' ...}
cb format data
Service "get" method returns correct value (object) sent by server, but the "list" method as result return array which contains $promise and $resolved...
Does anyone has some logic explanation?
UPDATE:
I found the problem. Service result is array of strings and that cause as result array of sting chars. This can be solved by using $http instead of $resource.
Ex:
server-side -> ['list', 'of', 'elements']
client-side -> ['l','i','s','t']