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

Providing an example of customizing actions on $resource factory. #11860

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/ngResource/resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ function shallowClearAndCopy(src, dst) {
* - **`interceptor`** - `{Object=}` - The interceptor object has two optional methods -
* `response` and `responseError`. Both `response` and `responseError` interceptors get called
* with `http response` object. See {@link ng.$http $http interceptors}.
*
*
* @param {Object} options Hash with custom settings that should extend the
* default `$resourceProvider` behavior. The only supported option is
Expand All @@ -179,6 +180,15 @@ function shallowClearAndCopy(src, dst) {
* 'remove': {method:'DELETE'},
* 'delete': {method:'DELETE'} };
* ```
* You can provide your own set of methods by configuring the $resourceProvider like this:
* ```js
* $resourceProvider.defaults.actions = {
* create: {method: 'POST'},
* read: {method: 'GET', isArray:true},
* update: {method: 'PUT'},
* delete: {method: 'DELETE'}
* };
* ```
*
* Calling these methods invoke an {@link ng.$http} with the specified http method,
* destination and parameters. When the data is returned from the server then the object is an
Expand Down