javascript - Post method in Angular JS -
i have following code:
var req = { method: 'post', url: '/customer', headers: { 'content-type': 'application/json' }, data: { test: 'testvalue' } }; $http(req).then(function(){ console.log("f1") },function(){ console.log("f2") });
the code above posts this:
{ '{"test":"testvalue"}': '' }
when need this:
{"test":"testvalue"}
does 1 know solution problem?
use $http.post
method:
$http.post('/customer', { test: 'testvalue' }, { headers: { 'content-type': 'application/json' } }).then(function(){ console.log("f1") },function(){ console.log("f2") });
Comments
Post a Comment