asafdav / ng-csv

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

Added label attribute to define whether or not using keys as column value #122

Closed shaohaolin closed 8 years ago

shaohaolin commented 8 years ago

Using all the keys in first object of array to create the header for CSV file when csv-label set it to true. It only accepts Boolean value. ng-csv="dataArray" csv-label="true" Input data: $scopedataArray = [ { "Vehicle": "BMW", "Date": "30, Jul 2013 09:24 AM", "Location": "Hauz Khas, Enclave, New Delhi, Delhi, India", "Speed": 42 }, { "Vehicle": "Honda CBR", "Date": "30, Jul 2013 12:00 AM", "Location": "Military Road, West Bengal 734013, India", "Speed": 0 } ];

Output file: ng-csvheader

asafdav commented 8 years ago

Thank you!