1.0.2 • Published 8 years ago

ng-download-csv v1.0.2

Weekly downloads
12
License
MIT
Repository
github
Last release
8 years ago

ng-download-csv

angular service for downloading text/csv content as file from a server, using code from this stackoverflow post

install

npm install --save ng-download-csv

usage

require('angular')
require('ng-download-csv')

var exampleApp = angular.module('exampleApp', ['ngDownloadCsv'])

exampleApp.controller('exampleController', ['$scope', 'DownloadCSV', function ($scope, DownloadCSV) {

  // downloads a csv with filename 'a-good-title.csv'
  DownloadCSV({
    url: 'http://example.com/api/resource.csv',
    filename: 'a-good-title'
  }).success(function (data, status, headers, config) {
    // on download success ...
  }).error(function (data, status, headers, config) {
    // on download error ...
  })

}])