Let's consider a very simple scenario:
Here is the code snippet:
$.ajax({
type: "GET/POST",
url: 'http://somewhere.net/',
data: data,
beforeSend: '', // custom property
}).done().fail();
My main goal is to find a proper way to modify the beforeSend
function within an Angular factory service. Here is an example of what I currently have in my code:
myApp.factory('GetBalance', ['$resource', function ($resource) {
return $resource('/Service/GetBalance', {}, {
query: { method: 'GET', params: {}, }, isArray: true,
});
}]);
In this case, I am utilizing AngularJs service API, however, the documentation available is not very clear on how I can achieve my desired modification.