Skip to content

Commit

Permalink
fix(reports): unable to download reports #106
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Nov 13, 2018
1 parent dca823e commit a2cdb7f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/public/js/angularjs/controllers/reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

define(['angular', 'underscore', 'jquery', 'moment', 'modules/helpers', 'history'], function(angular, _, $, moment, helpers) {
return angular.module('trudesk.controllers.reports', [])
.controller('reportsCtrl', function($scope, $http, $log, $timeout, $document, $window) {
.controller('reportsCtrl', function($scope, $http, $log, $timeout, $window) {

var $filterDateStart = $('.filterDate_Start');
$filterDateStart.each(function(index, element) {
Expand Down Expand Up @@ -247,10 +247,11 @@ define(['angular', 'underscore', 'jquery', 'moment', 'modules/helpers', 'history
function downloadReport(response, filename) {
var headers = response.headers();
var blob = new Blob([response.data],{type:headers['content-type']});
var link = $document.createElement('a');
var link = $window.document.createElement('a');
link.href = $window.URL.createObjectURL(blob);
link.download = filename + '.csv';
link.click();
link.remove();
}

});
Expand Down

0 comments on commit a2cdb7f

Please sign in to comment.