I try to post data from angularJS to my web-Service and want to get data back.
The post-request works great, I get data back (which I hardcoded in PHP), but (after 2h searching) my problem is that I cant send some Post-Data.
Here my code:
   angular.module('LunchApp', [])
  .controller('MessagesCtrl', function($scope, $http){
        $http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded";
        var postData = { callMethod: 'getChat' };
        $http.post(url, postData).success(function(data){
            $scope.messages = data;
        });
  });
I have tried many solutions:
- https://www.youtube.com/watch?v=vs-egO-odAg
- How do I POST urlencoded form data with $http in AngularJS?
- $http post in Angular.js
but nothing works for me... :(
If I try it with a RESTful TestClient, it works perfectly. all posted data reach the server. But not with AngularJS :(
 
    