@@ -56,9 +56,7 @@ function shallowClearAndCopy(src, dst) {
56
56
*
57
57
* <div doc-module-components="ngResource"></div>
58
58
*
59
- * See {@link ngResource.$resource `$resource`} for usage.
60
- *
61
- * See {@link ngResource.$resourceProvider `$resourceProvider`} for usage.
59
+ * See {@link ngResource.$resourceProvider} and {@link ngResource.$resource} for usage.
62
60
*/
63
61
64
62
/**
@@ -67,13 +65,11 @@ function shallowClearAndCopy(src, dst) {
67
65
*
68
66
* @description
69
67
*
70
- * Use for configuring {@link ngResource.$resource `$resource`} in module configuration phase.
71
- *
72
- * ## Example
73
- * See {@link ngResource.$resourceProvider#defaults `Properties`} for configuring `ngResource`.
68
+ * Use `$resourceProvider` to change the default behavior of the {@link ngResource.$resource}
69
+ * service.
74
70
*
75
71
* ## Dependencies
76
- * Requires {@link ngResource `ngResource` } module to be installed.
72
+ * Requires the {@link ngResource } module to be installed.
77
73
*
78
74
*/
79
75
@@ -424,45 +420,64 @@ angular.module('ngResource', ['ng']).
424
420
* @ngdoc property
425
421
* @name $resourceProvider#defaults
426
422
* @description
427
- * A configuration object for `$resource` instances.
423
+ * Object containing default options used when creating `$resource` instances.
428
424
*
429
- * Properties of this object are initialized with a set of values that satisfies a wide range of use cases.
430
- * User can also choose to override these properties in application configuration phase.
425
+ * The default values satisfy a wide range of usecases, but you may choose to overwrite any of
426
+ * them to further customize your instances. The available properties are:
431
427
*
432
- * Property `stripTrailingSlashes`, default to true, strips trailing slashes from
433
- * calculated URLs.
428
+ * - **stripTrailingSlashes** – `{boolean}` – If true, then the trailing slashes from any
429
+ * calculated URL will be stripped.<br />
430
+ * (Defaults to true.)
431
+ * - **cancellable** – `{boolean}` – If true, the request made by a "non-instance" call will be
432
+ * cancelled (if not already completed) by calling `$cancelRequest()` on the call's return
433
+ * value. For more details, see {@link ngResource.$resource}. This can be overwritten per
434
+ * resource class or action.<br />
435
+ * (Defaults to false.)
436
+ * - **actions** - `{Object.<Object>}` - A hash with default actions declarations. Actions are
437
+ * high-level methods corresponding to RESTful actions/methods on resources. An action may
438
+ * specify what HTTP method to use, what URL to hit, if the return value will be a single
439
+ * object or a collection (array) of objects etc. For more details, see
440
+ * {@link ngResource.$resource}. The actions can also be enhanced or overwritten per resource
441
+ * class.<br />
442
+ * The default actions are:
443
+ * ```js
444
+ * {
445
+ * get: {method: 'GET'},
446
+ * save: {method: 'POST'},
447
+ * query: {method: 'GET', isArray: true},
448
+ * remove: {method: 'DELETE'},
449
+ * delete: {method: 'DELETE'}
450
+ * }
451
+ * ```
434
452
*
435
- * Property `actions` is an object that sets up high level methods/aliases on `$resource` object
436
- * based on standard HTTP methods. Users can supply an "actions" object with method aliases that
437
- * comply with alternative conventions.
453
+ * #### Example
438
454
*
439
- * To add your own set of configurations, set it up like so:
440
- * ```
441
- * angular.module('myApp').config(['resourceProvider', function ($resourceProvider){
455
+ * For example, you can specify a new `update` action that uses the `PUT` HTTP verb:
442
456
*
443
- * // Provide your own set of actions on $resource factory.
444
- * // The following comments are Angular's default actions, which are being
445
- * // replaced by an object that includes a PUT method as shown.
446
- * // { 'get': {method:'GET'},
447
- * // 'save': {method:'POST'},
448
- * // 'query': {method:'GET', isArray:true},
449
- * // 'remove': {method:'DELETE'},
450
- * // 'delete': {method:'DELETE'} };
457
+ * ```js
458
+ * angular.
459
+ * module('myApp').
460
+ * config(['resourceProvider', function ($resourceProvider) {
461
+ * $resourceProvider.defaults.actions.update = {
462
+ * method: 'PUT'
463
+ * };
464
+ * });
465
+ * ```
451
466
*
452
- * $resourceProvider.defaults.actions = {
453
- * create:{method: 'POST'},
454
- * save: {method: 'POST'},
455
- * update:{method: 'PUT'},
456
- * get: {method: 'GET'},
457
- * query: {method: 'GET', isArray:true},
458
- * remove: {method: 'DELETE'},
459
- * delete: {method: 'DELETE'}
460
- * };
467
+ * Or you can even overwrite the whole `actions` list and specify your own:
461
468
*
462
- * // Don't strip trailing slashes from calculated URLs.
463
- * // Consult your application server's configuration to work in concert with this setting.
464
- * $resourceProvider.defaults.stripTrailingSlashes = false;
465
- * }]);
469
+ * ```js
470
+ * angular.
471
+ * module('myApp').
472
+ * config(['resourceProvider', function ($resourceProvider) {
473
+ * $resourceProvider.defaults.actions = {
474
+ * create: {method: 'POST'}
475
+ * get: {method: 'GET'},
476
+ * getAll: {method: 'GET', isArray:true},
477
+ * update: {method: 'PUT'},
478
+ * delete: {method: 'DELETE'}
479
+ * };
480
+ * });
466
481
* ```
467
482
*
468
483
*/
0 commit comments