Code Monkey home page Code Monkey logo

ng-csv's Introduction

ngCsv - Export to CSV using AngularJS

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

Build Status

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

ng-csv's People

Contributors

asafdav avatar daraliu avatar dotansimha avatar happyminded avatar bitdeli-chef avatar langman66 avatar isakb avatar ada-lovecraft avatar formation-sqli avatar

Watchers

James Cloos avatar Moran Fine avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.