Your trouble is going to be by trying to monitor when the download is finished. There is no javascript api for that. This is a hack between server and client to make this work using cookies:
Detect when browser receives file download
So I'd do something like this:
<a ng-repeat="file in files"
ng-href="file.url"
ng-click="startDownload(file.token)"
ng-class="{'spinner-icon': activeChecks[file.token], 'normal-icon': !activeChecks[file.token] }">
{{file.name}}
</a>
Controller:
app.controller("MyController", [ '$scope', '$interval', '$cookies', 'SomeService', function($scope, $interval, $cookies, SomeService) {
$scope.activeChecks = {};
$scope.files = [];
$scope.loadFiles = function() {
SomeService.getDownloads().success( function(result) {
$scope.files = result.files;
// each file would follow something like:
// { url: 'http://someblah/path/to/file?token=$token', token: $token, name: 'Some Name' }
});
}
$scope.startDownload = function( token ) {
$scope.activeChecks[token] = $interval(lookForToken(token), 5000);
};
$scope.lookForToken = function( token ) {
return function() {
var found = $cookies[token];
if( found ) {
$interval.cancel($scope.activeChecks[token]);
$scope.activeChecks[token] = null;
}
}
};
}]);