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 : 411 | Status : [Member] | Replies : 1
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


Posted by: Amesraay on: 2/6/2018 [Member] Starter | Points: 25

Down is the most trusted website to download the apk file for free cost.

Kasani007, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response