Search code examples
angularjscoffeescriptrestangular

Restangular - send several params on RestangularService.one()


I'd like to know if it is possible to send more than one param in RestangularService.one(id)? here is the code I have:

r = Restangular.service("patients")
patient: (patientId) ->
  r.one(patientId).get().then (response) ->
    return response.patient

is it possible to send more data? something like:

patient: (patientId, data1, data2)

To be more explicit: Here is the result I get by r.one(patientId).get():

{"format"=>"json", "controller"=>"api/patients", "action"=>"show", "id"=>"patientId"}

I'd like to have something like:

{"format"=>"json", "controller"=>"api/patients", "action"=>"show", "id"=>"patientId", "data1" =>"value", "data2" => "value"}


Solution

  • Additional query parameters are sent in the get method:

    r.one(patientId).get({
        data1: "data1Value",
        data2: "data2Value"
    })