Search code examples
javascriptjsonangularjsrestangular

Restangular: impossible to post complex json parameters?


I would like to send complex json to a put route:

    Restangular.one('model3ds', model.uuid).put(
       api_key: "blabla"
       model3d: { is_public: true }
    )

But it does not seems possible with Restangular, since it send:

api_key: "blabla"
model3d: "{\"is_public:\":true}"

Anyone knows how to change this behavior ?

Note: I can do that, but it's not possible if i have a full object to send, not only a property.

    Restangular.one('model3ds', model.uuid).put(
        "model3d[is_public]": true
    )

Solution

  • Ok I found the (very complicated !) answer: All the magic is in the custom keyword ;)

    Restangular.one('model3ds', model.uuid).customPUT(
       api_key: "blabla"
       model3d: { is_public: true }
    )