Angular 2: File Saver

25.3k views Asked by At

iam trying to implement a download button in my Angular 2 application. I have used these tutorials: http://alferov.github.io/angular-file-saver/ https://coryrylan.com/blog/angular-2-cli-adding-third-party-libraries

So i installed file-saver by: npm install angular-file-saver

But import FileSaver from 'file-saver'; or import FileSaver from 'angular-file-saver'; doesnt work.

Error: Cannot find module 'file-saver'.

How do i get this working?

Thank you

1

There are 1 answers

0
Julien Jacobs On BEST ANSWER

http://alferov.github.io/angular-file-saver/ is a AngularJS service so it won't work for Angular2.

Refer to the one of the many SO questions already answered