I am trying to convert csv to array on angular 1.5+ionic on hebrew. I am using ng-csv. What I done till now:
Html:
<ng-csv-import
class="import"
content="csv.content"
header="csv.header"
header-visible="csv.headerVisible"
separator="csv.separator"
separator-visible="csv.separatorVisible"
result="csv.result"
encoding="csv.encoding"
encoding-visible="csv.encodingVisible"></ng-csv-import>
my controller is :
.controller('SettingsCtrl', function ($scope,$parse) {
$scope.csv = {
content: null,
header: true,
headerVisible: true,
separator: ',',
separatorVisible: true,
result: null,
encoding: 'Windows-1255',
encodingVisible: true
};
what else should be done to get the object as array.
Modify the code in your controller as
$scope.csv = {
content: null,
header: true,
headerVisible: true,
separator: ',',
separatorVisible: true,
result: null,
encoding: 'ISO-8859-1',
encodingVisible: true,
accept:".csv"
};
and your in your html
<ng-csv-import content="csv.content"
header="csv.header"
separator="csv.separator"
result="csv.result"
accept="csv.accept">
</ng-csv-import>
$scope.csv.result will now be an array of objects
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With