I am using AngularJS, and I have a MVC 4 API that returns a HttpResponseMessage with an attachment.
var result = new MemoryStream(pdfStream, 0, pdfStream.Length) {
Position = 0
};
var response = new HttpResponseMessage {
StatusCode = HttpStatusCode.OK,
Content = new StreamContent(result)
};
response.Content.Headers.ContentDisposition =
new ContentDispositionHeaderValue("attachment") {
FileName = "MyPdf.pdf"
};
response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
return response;
I am using a jQuery plugin called fileDownload... which download the file beautifully... but I havent found the way to do this in the "Angular" way... any help will be appreciated.
// _e
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…