lb-statistics-filter-directive.html
<a class="btn btn-sm btn-primary" ng-click="downloadExcel(downloadUrl)" target="_blank" ng-class="{'disabledEvent':!hasPreviewData}">
lb-statistics-filter-directive.js
controller: function($scope,$http, $element, $attrs){
$scope.downloadExcel = function(downloadUrl){
console.log(downloadUrl)
$http.get(downloadUrl,
{responseType: "arraybuffer"},
{timeout:600000}
)
.success(function (data, status, headers, config) {
var blob = new Blob([data], {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});
var a = document.createElement("a");
document.body.appendChild(a)
a.download = $filter('date')(new Date(), 'yyyyMMddHHmmss') + ".xls";
a.href = URL.createObjectURL(blob);
a.click();
})
}