I feel the need to clarify this if someone else finds this question.
Passing $scope.company passes the JS object, which is the company , which does not include the name of the scope variable itself:
{ name: 'Test Company', owner: { name: 'Test Owner' } }
The server will see this as a POST variable named name , which is a string with the value "Test Company" and another variable named owner , which is an array with an index named name with the value 'Test Owner `
In PHP, it will be as follows:
$_POST['name']; // would = 'Test Company' $_POST['owner']; // would = array('name'=>'Test Owner')
If you want this to be a server-side property array called company , you need to encapsulate $scope.company into a JS object using a property called company:
$scope.company = { company: { name : 'Test Company', owner : { name : 'Test Owner' } } };
Now on the server side you will find the following:
$_POST['company']; // would = array('name'=>'Test Company','owner'=>array('name'=>'Test Owner'))
source share