Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 1d36cff

Browse files
standup75jeffbcross
standup75
authored andcommitted
docs(ngResource): document steps to skip default json serialization/deserialization
1 parent 56f09f0 commit 1d36cff

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/ngResource/resource.js

+6
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,16 @@ function shallowClearAndCopy(src, dst) {
136136
* `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
137137
* transform function or an array of such functions. The transform function takes the http
138138
* request body and headers and returns its transformed (typically serialized) version.
139+
* By default, transformRequest will contain one function that checks if the request data is
140+
* an object and serializes to using `angular.toJson`. To prevent this behavior, set
141+
* `transformRequest` to an empty array: `transformRequest: []`
139142
* - **`transformResponse`** –
140143
* `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
141144
* transform function or an array of such functions. The transform function takes the http
142145
* response body and headers and returns its transformed (typically deserialized) version.
146+
* By default, transformResponse will contain one function that checks if the response looks like
147+
* a JSON string and deserializes it using `angular.fromJson`. To prevent this behavior, set
148+
* `transformResponse` to an empty array: `transformResponse: []`
143149
* - **`cache`** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
144150
* GET request, otherwise if a cache instance built with
145151
* {@link ng.$cacheFactory $cacheFactory}, this cache will be used for

0 commit comments

Comments
 (0)