how to use SheetJS (js-xlsx) in angular 2

后端 未结 6 1864
旧巷少年郎
旧巷少年郎 2020-12-29 16:29

I\'m learning angular2 and i wanted to use js-xlsx library in my project.

I installed xlsx npm install xlsx and jszip npm install jszip an

6条回答
  •  独厮守ぢ
    2020-12-29 16:32

    I installed the xlsx package, e.g. "npm install --save xlsx". It updated the package.json file with xlsx as a dependency. And now in my component I can import it, e.g. "import * as XLSX from 'xlsx' ". I'm using Angular 4. I guess, in Angular 2 it should work exactly the same way. P.S. There is no need to include the javascript file in the index.html.

提交回复
热议问题