I have some problem when I'm using $http with my API that I've written using Symfony. When I'm using $http.get at server side I'm adding a header to response : Access-Control-Allow-Origin and everything works and I can get required data from server. But when I'm using $http.post and adding this header , nothing works.
$http.post('http://myhost.loc/posts', {data:'Test string'}).success(function(data, status){
console.log(data);
}).error(function(data, status){
console.log(status);
});
And I get an error : OPTIONS http://myhost.loc/posts and No 'Access-Control-Allow-Origin' header is present on the requested resource. I don't understand why this doesn't work.