1 | # according to the ngResource documentation:
|
2 | # Resource.action([parameters], [success], [error])
|
3 | module.exports = processReadArgs = ($q, args) ->
|
4 | args = Array::slice.call args
|
5 | params = if angular.isObject(args[0]) then args.shift() else {}
|
6 | [success, error] = args
|
7 |
|
8 | deferred = $q.defer()
|
9 | deferred.promise.then success if angular.isFunction success
|
10 | deferred.promise.catch error if angular.isFunction error
|
11 |
|
12 | {params, deferred}
|