BaseResource
d7-services.commons
An abstract resource providing retrieve, create, update, delete and index functions. This service is used to handle the resources basic get put pust delete operations.
Prepares the options for an index request
Param | Type | Details |
---|---|---|
options | Object |
|
options.page | Integer |
|
options.pagesize | Integer |
|
options.fields | object |
|
options.parameters | object |
|
String | formated params as string or empty string |
generic function for http requests that emits events on success and on error
Param | Type | Details |
---|---|---|
requestConfig | Object |
|
pubError | Function |
|
pubSuccess | Function |
|
Promise | Promise of the retrieve request |
subscriba to an event
angular .module('myModule', ['d7-services.commons']) .controller('myController',function ($scope,BaseResource) { var requestConfig = { url : 'path/to/resource?param=test', method :'GET' }; var pubSuccess = function(success){...}; var pubError = function(error){...}; BaseResource.request().then(function(success){...}, function(error){...}); }