如何使用角度打字稿按日期将数据导出到 csv

时间:2021-02-01 20:51:37

标签: javascript angular typescript

所以我首先尝试使用 angular 11 中的材质按钮导出数据,这里是导出数据的代码,没有任何日期元素,可以正常工作。

go run test2.go < prod-slr.json
'json: cannot unmarshal object into Go value of type []main.siterouters

现在如果我添加 datepicker 并且我有开始和结束日期,并且应该在这两者之间导出数据,我应该做什么?

downloadCSV() {
    // subscribing the data from the url in exportData function 
    this.dataSvc.exportData().subscribe(data => {
      this.export = data
      //variable
      let jsonArrayObject = [];
      //looping through the array of objects
      for (let i = 0; i < this.export['data'].length; i++) {
        jsonArrayObject.push(this.export['data'][i]);
        // console.log(jsonArrayObject);
      }
      ///this.dtHolidays : JSONDATA , HolidayList : CSV file Name, this.csvOptions : file options
      new AngularCsv(jsonArrayObject, "ExgenReceipts", this.csvOptions);

    })

CLick here for UI

找人来帮助我这个刚接触 angular 的人

0 个答案:

没有答案