say have following form comprising model , nested model:
<label>company name</label> <input type="text" ng-model="company.name" /> <label>owner name</label> <input type="text" ng-model="company.owner.name" />
which post this:
restangular.all('companies').post($scope.company);
what i'm expecting on server end (in case rails) nested hash this:
company: name: test company owner: name: test owner
but i'm getting this:
name: test company company: name: test company owner: name: test owner
it appears models being flattened, , fields first model repeated outside of scoping.
how can post model whilst maintaining nesting , preferably not repeating models fields outside of scope in hash?
i'm creator of restangular.
could console.log
output of $scope.company?
restangular isn't flattering anything. it's sending exact json you've provided parameter, that's why should check output of $scope.company.
after that, can check further.
also, have checked network tab payload of request? ok?
Comments
Post a Comment