How do I post data using $resource using angularjs
I'm having a bit of a problem, I'm trying to do a http post request to my
backend php. I'm new to angular and wanted to try the different REST
method. I'm good with GET method. After this I will try UPDATE and DELETE
method but for now I'm stuck on this. T__T.
Here a bit of the code in php
$data = array(
"email" => $email,
"password" => $this->input->post("password")
);
$insert_data = $this->player_registration->insert($data);
And here my factory
var factory = {};
factory.registerPlayer = function() {
return $resource( apiUrl + ':type', {type:'player'}, {
post: {method:'POST', params: {}}
});
};
And my controller
$scope.inputs = {};
$scope.inputs.email = "testuser@domain.com";
$scope.inputs.password = "password";
var req = new webService.registerPlayer($scope.inputs);
req.save()
No comments:
Post a Comment