I use swagger to call api it works (for 'GET', 'POST' and 'PUT'), but when I was trying to call API via $resource method: 'PUT', it gives me OPTIONS, and cannot make the call. Is there someone who knows how to fix this? Below attached code:
var data = $resource('url', {id: '@id'}, { update: { method: 'PUT'}});
var modifyObject = function (obj) {
var deferred = $q.defer();
data.update({id: obj.id}, obj, function (data) {
deferred.resolve(data);
}, function (error) {
deferred.reject(error);
});
return deferred.promise;
};
modifyObject(requestObj).then(function (data) {
console.log(data);
},
function (error) {
console.log(error);
}
);
Attached the resolve and same issue: How does Access-Control-Allow-Origin header work?