I am trying to send some JSON to my controller using angular's http post method. The following json gets sent to the orderAction in my controller:
{"food":"pizza","drink":"beer"}
in my controller i tried receiving the request like this:
public function orderAction($data)
{
$this->view->disable();
if ($this->request->isPost()) {
if (isset($data)) {
echo $data;
} else {
echo "No data received";
}
}
}
The $data object is always null and i keep getting my 'No data received response'. Which brings me to the following question: how do i access the sent json data in the controller?