ng-csv
ng-csv copied to clipboard
JSON/JS array format
Looking forward to using this module!
What's missing in the docs (IMO) is the format of the array - there are several different potential array formats.
I can try to figure this out, but it would best if this were explicitly stated, all we need is a couple elements in the array and we will get the idea so it should fit easily in the README.md file, thx
in other words, I am looking for:
$scope.getArray = function(){
return []; // what format is the array supposed to have? :)
};
so I tried this:
$scope.getArray = function () {
return [
{
a: 'b',
c: 'd',
x: 'e'
},
{
a: 'v',
c: 'r',
x: 't'
}];
};
and I basically get:
b,d,e
v,r,t
so that seems to work, but I wish the headers would be inferred
if you use the csv-label
directive then the keys will be the header row of the csv file.
csv-label: Defines whether or not using keys as csv column value (default is false).