I want to show Save As File Dialog on click of a button in my html5 page. May I know how this can be achieved in Angular 6/Typescript?
Asked
Active
Viewed 7,317 times
0
-
Just use a normal HTML file input e.g. `` – Kelvin Lai Jul 08 '19 at 04:12
-
Thank you Kelvin. But it shows Open File Dialog not Save As. May I know how to show that? – Kannan Thirumal Jul 08 '19 at 04:32
-
Possible duplicate of [JavaScript: Create and save file](https://stackoverflow.com/questions/13405129/javascript-create-and-save-file) – Kelvin Lai Jul 08 '19 at 04:37
-
What is the file you want to download? Is it is the web page itself or some other external file? – Kavinda Jayakody Jul 08 '19 at 04:48
-
I want to get the path from the Save As file dialog and save as either an image file or zip file etc? – Kannan Thirumal Jul 08 '19 at 05:01
-
Kelvin: JavaScript: Create and save file : This looks like how to save a context to a given file name rather than showing a save as file dialog? – Kannan Thirumal Jul 08 '19 at 05:18
1 Answers
0
you can achieve that using ngx-filesaver this is documentation https://www.npmjs.com/package/ngx-filesaver this is Demo https://cipchk.github.io/ngx-filesaver/

d.alsafadi
- 34
- 2
-
3Thanks ! I checked the demo, it save the data in different file format with the file name save.txt etc but NOT showing Save As File dialog to get the path/file name from the user. – Kannan Thirumal Jul 08 '19 at 06:12
-
1