Request and response with Angular $post and PHP Codeigniter Request and response with Angular $post and PHP Codeigniter codeigniter codeigniter

Request and response with Angular $post and PHP Codeigniter


If you want to send as form encoded data you need to serialize the whole data object with $.param()

Change:

 data: {user: $.param($scope.user)},

To

 data: $.param(angular.copy({user: $scope.user})),

Or use $httpParamSerializerJQLike

If you use defaults of $http would just be

 $http.post( '/registration',$scope.user).then(...

And in php

$data = json_decode(file_get_contents('php://input'));