asafdav / ng-csv

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

It doesn't escape commas properly #60

Closed yonatang closed 9 years ago

yonatang commented 9 years ago

If you add a string with comma inside, you'll get a wrong number of columns. For examlpe:

angular.module('csv', ['ngCsv']);

function Main($scope) {
    $scope.sample = "Sample";
    $scope.getArray = [{a: 1, b:2}, {a:3, b:"asdas,dsadas"}];                            
}

Will result:

1,2
3,asdas,dsadas

while it should be

1,2
3,"asdas,dsadas"
asafdav commented 9 years ago

What version are you using ? it's already handled since version v0.0.7, You can see the test cases and the recent build.

yonatang commented 9 years ago

Oh, sorry. I've evaluated it in the live demo page (http://jsfiddle.net/asafdav/dR6Nb/) and assumed it demonstrate a more recent build. Perhaps you'll consider updating the jsfiddle page/link?

asafdav commented 9 years ago

That's a good idea, there are up to date examples in the repository but I should probably update the live example as well. will take care of it soon.

asafdav commented 9 years ago

see the new README.