Skip to content
forked from asafdav/ng-csv

Simple directive that turns arrays and objects into downloadable CSV files

License

Notifications You must be signed in to change notification settings

jmekdahl/ng-csv

 
 

Repository files navigation

ngCsv - Export to CSV using AngularJS

An AngularJS simple directive that turns arrays and objects into downloadable CSV files,

Usage

  1. Add ng-csv.min.js to your main file (index.html)

  2. Set ngCsv as a dependency in your module

var myapp = angular.module('myapp', ['ngCsv'])
  1. Add ng-csv directive to the wanted element, example:
<button type="button" ng-csv="getArray()" filename="test.csv">Export</button>

ngCsv attributes

  • ng-csv: The data array

  • filename: The filename that will be stored on the user's computer

  • csv-header: If provided, would use this attribute to create a header row

    <button type="button" ng-csv="getArray()" csv-header="['Field A', 'Field B', 'Field C']" filename="test.csv">Export</button>
  • field-separator: Defines the field separator character (default is)

  • text-delimiter: If provided, will use this characters to "escape" string values

Example

You can check out this live example here: http://jsfiddle.net/asafdav/dR6Nb/

Bitdeli Badge

About

Simple directive that turns arrays and objects into downloadable CSV files

Resources

License

Stars

Watchers

Forks

Packages

No packages published