Could anyone tell me why the following statement does not send the post data to the designated url? The url is called but on the server when I print $_POST - I get an empty
Unlike JQuery and for the sake of pedantry, Angular uses JSON format for POST data transfer from a client to the server (JQuery applies x-www-form-urlencoded presumably, although JQuery and Angular uses JSON for data imput). Therefore there are two parts of problem: in js client part and in your server part. So you need:
put js Angular client part like this:
$http({
method: 'POST',
url: 'request-url',
data: {'message': 'Hello world'}
});
AND
write in your server part to receive data from a client (if it is php).
$data = file_get_contents("php://input");
$dataJsonDecode = json_decode($data);
$message = $dataJsonDecode->message;
echo $message; //'Hello world'
Note: $_POST will not work!
The solution works for me fine, hopefully, and for you.