Closed MrFurther closed 9 years ago
Currently nested arrays are not supported, you can easily manipulate your data before exporting it, either live or using the "lazy-load" option.
something like
$scope.data = [{}, {},...] // Collection
$scope.getDataForCsv = function() {
var myData = [];
data.forEach(function(obj) {
myData.push({x: obj.x, name: obj.pax.name});
});
}
<button ng-csv="getDataForCsv()" lazy-load="true">Export</button>
Your code works wonders in my app, but I ran into a problem when trying to include nested arrays into the file.
It basically outputs something like this:
Date,Time,Car,Driver,From,Destination,Pax,Comment,Comment Time,Arrival 02/12, 21.59, 396, Mango, A, B, [object Object],[object Object], , , 22.00.10
Being every [object Object] an object inside the object.pax array*.
*pax [ {name : "Vincent", chosen : true}, {name : "Karin", chosen : true}]
Has anybody reported something similar? Any idea about how to deal with this?