How to read csv file in Angular-4 assets

后端 未结 2 1301
温柔的废话
温柔的废话 2021-02-10 13:55

I am new to angular-4 and I want to read a csv file from angular-4 assets directory, file size 5mb and I dont\'t want to read this file from django back-end server because this

2条回答
  •  太阳男子
    2021-02-10 14:41

    I finally find a answer Here is how I done it:

    csvUrl = 'assets/demo-Results.csv';
    readCsvData () {
          this.http.get(this.csvUrl)
            .subscribe(
              data => {
                console.log(data.text())
              },
              err => {
                console.log(err)
              });
      }
    

提交回复
热议问题