i have checked all the post i can find on the use of Filesaver JS with angular, but i still could not wrap my head around a soution. I added this to the map section of my system.config.js
'filesaver': 'node_modules/filesaver/src/Filesaver.js'
I added this to the packages section of the system.config.js
'filesaver': {defaultExtension: 'js'}
I then imported it in my service.ts this way
import { saveAs } from 'filesaver';
Yet i get this error.
Can someone help please?
I am using angular 6 (no systemjs.config.js file available in my project) + FileSaver. I needed to download PDF from server. Here is what worked:
package.json:
code:
Try the following
Then add a declarations file to your project like 'declarations.d.ts' and in it put
In your systemjs.config.js, add the following to the map section
And then import the library in your component or service like below
Hope it helps.
For angular-cli with http (followed by httpClient):
Add this third party lib to .angular-cli.json
In the blabla service:
Finally int the component:
httpClient
It's the same like http but the service method is different: