asafdav / ng-csv

Simple directive that turns arrays and objects into downloadable CSV files
MIT License
573 stars 215 forks source link

ngCsv - Export to CSV using AngularJS

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

Build Status

Dependencies

How to get it ?

Manual Download

Download the from here

Bower

bower install ng-csv

Npm

npm install ng-csv

CDN

ng-csv is available at cdnjs

Usage

  1. Add ng-csv.min.js to your main file (index.html). please also make sure you're adding angular-sanitize.min.js.

  2. Set ngCsv as a dependency in your module

    var myapp = angular.module('myapp', ['ngSanitize', 'ngCsv'])
  3. Add ng-csv directive to the wanted element, example:

    <button type="button" ng-csv="getArray" filename="test.csv">Export</button>

ngCsv attributes

Examples

You can check out this live example here: https://asafdav.github.io/ng-csv/example/

For lazy load example using promises see this example: https://asafdav.github.io/ng-csv/example/lazy_load.html

Supported Browsers

Browser Filenames
Firefox 20+ Yes
Chrome 14+ Yes
Safari No
IE 10+ Yes

Bitdeli Badge