ng-download

Simple AngularJS Directive used to trigger an asynchronous-like file download


Keywords
download, angularjs, directive
License
MIT
Install
bower install ng-download

Documentation

ngDownload

Simple AngularJS Directive used to trigger an asynchronous-like file download

Usage:

  • Install: bower install ng-download
  • Add ngDownload to your code:
<script src="bower_components/ng-download.js"></script>
  • Add ngDownload as a dependency of your application.
angular.module('app', ['ngDownload']);
  • Implement the directive in your html:
<button ng-download="{{urlToPublicFile}}" params="optionalParameters">Download</button>
  • urlToPublicFile has to be an url to a public file
  • params (object) is optional. You can add all the query strings parameters you wish to add to the url

Done!