I am facing an issue with the exportChallenges
button on a kendo grid in my web application. The button is supposed to export grid data to excel by using an AngularJs factory. However, when I receive the rest service response as a Blob from the server side, it does not prompt the user on the browser for options to save, open, or download the file.
How can I resolve this problem either using AngularJs or native JavaScript?
The code snippet related to export functionality is shown below:
$scope.exportChallenges = function() {
processFactory.exportPrcChallenges($stateParams.processId, challengeType)
.success(function(response) {
var blob = new Blob([response.data], {
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
});
debugger;
var objectUrl = URL.createObjectURL(blob);
window.open(objectUrl);
});
};