This repository has been archived on 2022-01-02. You can view files and clone it, but cannot push or open issues/pull-requests.
AriaNg/src/scripts/directives/blobDownload.js

25 lines
791 B
JavaScript

(function () {
'use strict';
angular.module('ariaNg').directive('ngBlobDownload', ['ariaNgFileService', function (ariaNgFileService) {
return {
restrict: 'A',
scope: {
ngBlobDownload: '=ngBlobDownload',
ngFileName: '@',
ngContentType: '@'
},
link: function (scope, element) {
scope.$watch('ngBlobDownload', function (value) {
if (value) {
ariaNgFileService.saveFileContent(value, element, {
fileName: scope.ngFileName,
contentType: scope.ngContentType
});
}
});
}
};
}]);
}());