How To Pass Headers From WebApi To AngularJS Of $http.get(...).then(function(result){..})

Posted by Kasani007 under AngularJS on 11/1/2017 | Points: 10 | Views : 235 | Status : [Member] | Replies : 0
I Used the below but, it shows error
$http.get(...).success is not a function

I Used $http.get(...).then, it worked fine, but the headers send from webapi using httpresponsemessage result is not showing in .then(function(response){

when i used
httpResponseMessage.Content = new ByteArrayContent(bytes.ToArray());
httpResponseMessage.Content.Headers.Add("x-filename", fileName);
httpResponseMessage.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
httpResponseMessage.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment");
httpResponseMessage.Content.Headers.ContentDisposition.FileName = fileName;

Please help me how can i pass headers(filename, contenttype..etc) from webapi to angularjs $http.get(...).then(function(result){..})

Thanks In Advance


(No response found.)

Login to post response