how to RECEIVE downloadable file from server in AngularJS?

I am sending a downloadable file from backend to AngularJS. Whenever a GET request (with some data as parameters) is made to the "/report" url, the server sends a file that I want to receive in AngularJS. Ideally, a browser should prompt user for saving/opening a file that server sends. So far I have done this:

$scope.getReport = function () {

    console.log("getReport");

    var report_url = '/report';
    var some_data = "asdf";


    $http({method:'GET', url:report_url, data=some_data})
    .success(function(data) {

    });
};

Now I am unable to figure out how to get the file that server sent me.

Answers


I created this fiddle for you http://jsfiddle.net/xMdQV/

Instead of making a get request and waiting for the server to return a file that you want to download you could replace someData with your some_data Tested on Chrome, Firefox and IE9.


Need Your Help

C# Getting a complete file list using ftpRequest is slow

c# ftp performance filesize file-listing

I want to get the filename, file size and last modified time of each file on an FTP server, then populate a listView with it.

How to get lemmas from sentences in DKPro/UIMA?

java nlp uima dkpro-core

I'm trying to setup a pipeline, which produces lemmatized sentences. I know how to get either all sentences or all lemmas, but I don't know how to get collections of lemmas divided by sentence ends...