Im trying to receive data posted by Angular:
$scope.add = function() {
$http.post($rootScope.appUrl + '/nao/test', {"data": "fiskapa"})
.success(function(data, status, headers, config) {
console.log(data);
}).error(function(data, status) {
//Göra något
});
};
The problem is that fiskapa is not returned:
public function create($data)
{
return new JsonModel(array("data" => $data));
}
Data that is returned: Object { data=[0]}
You can get directly the json post:
$data = json_decode(file_get_contents('php://input'),TRUE);
Please, try this.