Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. function generateDocument () {
  2. Type.generateDoc({
  3. id: vm.typeId
  4. }).$promise.then(function (response) {
  5. var blob = new Blob([response], {type: 'application/octet-stream'});
  6. var url = (window.URL || window.webkitURL).createObjectURL(blob);
  7.  
  8. var element = angular.element('<a/>');
  9. element.attr({
  10. href: url,
  11. target: '_blank',
  12. download: 'survey.docx'
  13. })[0].click();
  14. $uibModalInstance.close(true);
  15. });
  16. }
  17.  
  18. 'generateDoc': {
  19. method: 'GET',
  20. url: 'api/data/types/:id/generate',
  21. isArray: false
  22. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement