asp.net - web api returned content missing when posting in angularjs -


i trying post data , return content posting .net web api using angularjs

here web api

[httppost]     public httpresponsemessage post()     {         return new httpresponsemessage()         {             content = new stringcontent(                 "<strong>test</strong>",                 encoding.utf8,                 "text/html"             )         };     } 

and here post client

$http({                 url: 'my happy url',                 method: "post",                 data: objdata,                 headers: {                     'content-type': 'text/html'                 }             }).success(function (data, status, headers, config) {                 console.log(headers());             }).error(function (data, status, headers, config) {                 console.log("error");             }); 

my problem not data returned. sure missing simple. help.

in above code data parameter empty , expect find string "test" in data parameter.

instead of httpresponsemessage, can try use ihttpactionresult? sample code below.

public ihttpactionresult postsample() {     return content(httpstatuscode.ok, "test string"); } 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

c - getting error: cannot take the address of an rvalue of type 'int' -

python - GitPython: check if git is available -