Use $resourceProvider to change the default behavior of the $resource service.
Requires the ngResource module to be installed.
|
Object containing default options used when creating The default values satisfy a wide range of usecases, but you may choose to overwrite any of them to further customize your instances. The available properties are:
For example, you can specify a new angular.
module('myApp').
config(['$resourceProvider', function ($resourceProvider) {
$resourceProvider.defaults.actions.update = {
method: 'PUT'
};
}]);
Or you can even overwrite the whole angular.
module('myApp').
config(['$resourceProvider', function ($resourceProvider) {
$resourceProvider.defaults.actions = {
create: {method: 'POST'},
get: {method: 'GET'},
getAll: {method: 'GET', isArray:true},
update: {method: 'PUT'},
delete: {method: 'DELETE'}
};
});
|
© 2010–2018 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://code.angularjs.org/1.7.8/docs/api/ngResource/provider/$resourceProvider