I update to 2.0.0-rc.2 and when I compile my angular project I receive this in console:
WARNING in ./src/app/pages/sidenav/components/info-alteracion/components/list-documents/list-documents.component.ts 80:16-22 "export 'saveAs' was not found in 'file-saver'
My code
import { saveAs } from 'file-saver';
/*...*/
this._http.getDocumento(this.id, id_doc, id_del).subscribe(
(result: Blob) => {
if ((result.type == 'application/pdf') || (result.type == 'text/html')) {
let fileURL = window.URL.createObjectURL(result);
window.open(fileURL);
} else {
saveAs(result, id_doc + '.zip');
}
},
err => throwError(err)
);
Any idea of how to fix it? Thanks in advance
That pice of code is irrelevant.
The code that is interesting is how you import the saveAs function in the top of your file
btw, v2 supports saving url's now
saveAs('/asset/doc.pdf', 'doc.pdf')
I update the piece of code. Btw, I import using this :
import { saveAs } from 'file-saver';
You can remove the object destruction
I don't understand your response
this is object destruction: const {foo} = {foo: 1}
You can remove the object destruction
means you should remove the object destructing and just do
import saveAs from 'file-saver';
Thanks, issue solved!