convert string csv to array on angular

◇◆丶佛笑我妖孽 提交于 2019-12-25 07:26:13

问题


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

来源:https://stackoverflow.com/questions/37700699/convert-string-csv-to-array-on-angular

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!