@@ -1208,66 +1208,82 @@ var toString = require('../lang/toString');
12081208 */
12091209function DSHttpAdapterProvider ( ) {
12101210
1211- this . $get = [ '$http' , '$log' , 'DSUtils' , function ( $http , $log , DSUtils ) {
1211+ /**
1212+ * @doc property
1213+ * @id DSHttpAdapterProvider.properties:defaults
1214+ * @name defaults
1215+ * @description
1216+ * Default configuration for this adapter.
1217+ *
1218+ * Properties:
1219+ *
1220+ * - `{function}` - `serialize` - See [the guide](/documentation/guide/adapters/index). Default: No-op.
1221+ * - `{function}` - `deserialize` - See [the guide](/documentation/guide/adapters/index). Default: No-op.
1222+ * - `{function}` - `queryTransform` - See [the guide](/documentation/guide/adapters/index). Default: No-op.
1223+ */
1224+ var defaults = this . defaults = {
1225+ /**
1226+ * @doc property
1227+ * @id DSHttpAdapterProvider.properties:defaults.serialize
1228+ * @name defaults.serialize
1229+ * @description
1230+ * Your server might expect a custom request object rather than the plain POJO payload. Use `serialize` to
1231+ * create your custom request object.
1232+ *
1233+ * ## Example:
1234+ * ```js
1235+ * DSHttpAdapterProvider.defaults.serialize = function (data) {
1236+ * return {
1237+ * payload: data
1238+ * };
1239+ * };
1240+ * ```
1241+ *
1242+ * @param {object } data Data to be sent to the server.
1243+ * @returns {* } Returns `data` as-is.
1244+ */
1245+ serialize : function ( data ) {
1246+ return data ;
1247+ } ,
12121248
12131249 /**
12141250 * @doc property
1215- * @id DSHttpAdapterProvider.properties:defaults
1216- * @name defaults
1251+ * @id DSHttpAdapterProvider.properties:defaults.deserialize
1252+ * @name defaults.deserialize
12171253 * @description
1218- * Default configuration for this adapter.
1254+ * Your server might return a custom response object instead of the plain POJO payload. Use `deserialize` to
1255+ * pull the payload out of your response object so angular-data can use it.
12191256 *
1220- * Properties:
1257+ * ## Example:
1258+ * ```js
1259+ * DSHttpAdapterProvider.defaults.deserialize = function (data) {
1260+ * return data ? data.payload : data;
1261+ * };
1262+ * ```
12211263 *
1222- * - `{function}` - `serialize` - See [the guide](/documentation/guide/adapters/index). Default: No-op.
1223- * - `{function}` - `deserialize` - See [the guide](/documentation/guide/adapters/index). Default: No-op.
1224- * - `{function}` - `queryTransform` - See [the guide](/documentation/guide/adapters/index). Default: No-op.
1264+ * @param {object } data Response object from `$http()`.
1265+ * @returns {* } Returns `data.data`.
12251266 */
1226- var defaults = this . defaults = {
1227- /**
1228- * @doc property
1229- * @id DSHttpAdapterProvider.properties:defaults.serialize
1230- * @name defaults.serialize
1231- * @description
1232- * Your server might expect a custom request object rather than the plain POJO payload. Use `serialize` to
1233- * create your custom request object.
1234- *
1235- * @param {object } data Data to be sent to the server.
1236- * @returns {* } Returns `data` as-is.
1237- */
1238- serialize : function ( data ) {
1239- return data ;
1240- } ,
1267+ deserialize : function ( data ) {
1268+ return data . data ;
1269+ } ,
12411270
1242- /**
1243- * @doc property
1244- * @id DSHttpAdapterProvider.properties:defaults.deserialize
1245- * @name defaults.deserialize
1246- * @description
1247- * Your server might return a custom response object instead of the plain POJO payload. Use `deserialize` to
1248- * pull the payload out of your response object so angular-data can use it.
1249- *
1250- * @param { object } data Response object from `$http()` .
1251- * @returns { * } Returns `data.data`.
1252- */
1253- deserialize : function ( data ) {
1254- return data . data ;
1255- } ,
1271+ /**
1272+ * @doc property
1273+ * @id DSHttpAdapterProvider.properties:defaults.queryTransform
1274+ * @name defaults.queryTransform
1275+ * @description
1276+ * Transform the angular-data query to something your server understands. You might just do this on the server instead.
1277+ *
1278+ * @param { object } query Response object from `$http()`.
1279+ * @returns { * } Returns `query` as-is .
1280+ */
1281+ queryTransform : function ( query ) {
1282+ return query ;
1283+ }
1284+ } ;
12561285
1257- /**
1258- * @doc property
1259- * @id DSHttpAdapterProvider.properties:defaults.queryTransform
1260- * @name defaults.queryTransform
1261- * @description
1262- * Transform the angular-data query to something your server understands. You might just do this on the server instead.
1263- *
1264- * @param {object } query Response object from `$http()`.
1265- * @returns {* } Returns `query` as-is.
1266- */
1267- queryTransform : function ( query ) {
1268- return query ;
1269- }
1270- } ;
1286+ this . $get = [ '$http' , '$log' , 'DSUtils' , function ( $http , $log , DSUtils ) {
12711287
12721288 /**
12731289 * @doc interface
@@ -4452,7 +4468,7 @@ module.exports = [function () {
44524468 * Load `dist/angular-data.js` or `dist/angular-data.min.js` onto your web page after Angular.js.
44534469 *
44544470 * #### Manual download
4455- * Download angular-data. 0.9.0.js from the [Releases](https://github.com/jmdobry/angular-data/releases)
4471+ * Download angular-data- 0.9.0.js from the [Releases](https://github.com/jmdobry/angular-data/releases)
44564472 * section of the angular-data GitHub project.
44574473 *
44584474 * ## Load into Angular
0 commit comments