0

Given:

 Users = $resource apiUrl+"/v1/users/?offset=:offset&limit=:limit&format=json", {}, 
     getNext: 
       method: 'GET'

 Users.getNext { offset:20, limit:20 }, (data)->
     console.log "got some data"

Instead of explicitly passing offset and limit, I'd like to pass current set and in transformRequest function extract limit and offset and set those parameters for the http call. How can I do it? Doing something like that not working:

 Users = $resource apiUrl+"/v1/users/?offset=:offset&limit=:limit&format=json", {}, 
     getNext: 
       transformRequest: transformReq(data)

transformReq = (data)->
   console.log "data == "+data

and even this doesn't:

transformReq = (data)-> 
   [
       (data) ->
           console.log "data =="+data     # undefined   
   ]
iLemming
  • 34,477
  • 60
  • 195
  • 309

1 Answers1

0

it will intercept the transformReq when use the POST method, I am looking for the way the deal with the req too.

Jack
  • 357
  • 3
  • 4