i am building my first site using angular and i encountered a problem of how to show loading bar when downloading a file.
- User clicks on a download link
- Client displays a "Loading..." message
- Client sends a request to server for generating and returning the file.
- Server returns the dynamically generated file to the client
- Client hides the "Loading..." message
- Client starts to download the file
I tried:
$scope.download= function () {
$scope.showLoading = true;
var url = 'http://localhost:9000/download?file=myfile';
$http.get(url).success(function (data) {
$scope.showLoading = false;
// what to do with data(file)?
});
}
how I can save the the file(data) using angular?