Issue
I am working on moving an angular 1.x site to a new angular 2.0 site I created the site using angular-cli 1.0.0-beta.15.
I have a button to export some data to a CSV file. When the page first loads I get an error message "Cannot find module 'file-saver'", but when I click the button everything works perfectly.
I have the FileSaver.js component installed:
package.json
...
"dependencies": {
...
"@types/filesaver": "0.0.30",
"file-saver": "^1.3.2"
...
}
...
in my export.service.ts:
import { saveAs } from 'file-saver';
...
let file = new Blob(['hello world'], { type: 'text/csv;charset=utf-8' });
saveAs(file, 'helloworld.csv');
...
Does anyone know how to resolve this error?
Solution
Install the new TypeScript 2 version.. that should work..
Answered By - Gregor Biswanger
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.