Open giladbeeri opened 9 years ago
Hi. If you don't want to see your custom methods in response, you can simply check if there is a request or response. For e.g.:
RestangularProvider.setOnElemRestangularized(function (elem, isCollection, what, ra) { if (!elem.fromServer) { elem.YOUR_CUSTOM_METHOD = function () { ... }; } return elem; });
I have a Restangular object returned from server, it has several Restangular methods, server data and one custom method that I added using
addRestangularMethod()
. After callingplain()
on the object, the original Restangular properties are removed, but the custom one isn't. I would like to be able to get a raw JSON object - the raw response from the server (or after applying interceptors, it doesn't matter in my case). Becauseplain()
doesn't do the job perfectly, currently I use something likeangular.fromJson(angular.toJson(res.plain()))
which removes also the custom method left afterplain
.