convert string csv to array on angular

2019-08-31 09:55发布

问题:

I am using factory to download the file csv and parse it to array. I am trying using angular-csv-import to parse my string to array. My string looks like:

name,total,table,active ↵דווד,2,1, ↵יוליק גו…, ↵בוריס וטניה ,2,25, ↵גיצה איגור,2,25.....

and my code is:

 DownloadFile.all().then(function (fileArray) {
              $scope.csv = {
                content: fileArray,
                header: true,
                headerVisible: true,
                separator: ',',
                separatorVisible: true,
                result: null,
                encoding: 'ISO-8859-1',
                encodingVisible: true

              };

then I am using:

 $scope.$watch('csv.result', function () {
    if ($scope.csv.result != null) {

I can't see that result is firing.... Maybe there is any other library that will format my string to normal array