AngularJS - Receive and download CSV

前端 未结 5 921
醉酒成梦
醉酒成梦 2020-12-11 17:11

I am using a nodeJS program as a server and an AngularJS web application as the client.

To create the CSV I\'m using the \"express-csv\" library (https://www.npmjs.c

5条回答
  •  庸人自扰
    2020-12-11 17:30

    Here I tried to make it simple. Assign all the back end records that you want to display in the file in the variable called obj. I will just say it as var obj = []. And inside the function just add the below code.

    var a = document.createElement("a");
    var csvContent = "Name, Address\n";
    
    for(var i =0; i 

提交回复
热议问题