Skip to content
/ ng-csv Public
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

Adamiko/ng-csv

This branch is 74 commits behind asafdav/ng-csv:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

dacd3ab · Sep 18, 2014

History

99 Commits
Jul 31, 2014
Jun 2, 2014
Jul 31, 2014
Jul 16, 2014
Aug 27, 2013
Aug 27, 2013
Aug 27, 2013
May 16, 2014
May 16, 2014
Nov 13, 2013
Jul 14, 2014
Jul 31, 2014
Jun 2, 2014
Aug 19, 2014

Repository files navigation

ngCsv - Export to CSV using AngularJS

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

Build Status

Dependencies

  • angular.js (of course!), any version starting with 1
  • angular-sanitize.js, any version starting with 1

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" fields, otherwise will use double quotes as deafult

  • quote-strings: If provided, will force escaping of every string field.

  • lazy-load: If defined and set to true, ngCsv will generate the data string only on demand. See the lazy_load example for more details.

Example

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

Supported Browsers

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

Bitdeli Badge

About

Simple directive that turns arrays and objects into downloadable CSV files

Resources

License

Stars

Watchers

Forks

Packages

No packages published