I'm trying to access a EndPoint
through AngularJS.
This is my Service:
angular.module('empresa-view')
.factory('empresaService', ['$resource', function ($resource) {
return $resource($SERVICES_CONTEXT + 'empresa/:params', {}, {
update: {
method: "PUT"
},
lista: {
method: 'GET',
params: {params: 'list'},
isArray: true
}
});
}]);
When I run the application it gives the following error:
GET XHR link [HTTP / 1.1 405 Method Not Allowed 5ms] error [object Object] main.js: 12: 21 Request cross-origin blocked: Same Origin Policy (Same Origin Prevents the remote resource from reading link . (Reason: the header CORS 'Access-Control-Allow-Origin' is not present).
But if I change the empresa/:params
by empresa/list'
it works and I can display get the data. Why params
is not working?