2

I want to save my data on my local drive but I first want to open the saveAs dialog box. How can I do that? Im using AngularJS

This is the code that I have

    <input type="button" value="Save" ng-click="dialogs.saveAs()">
<div id="dvData">
<script type="text/javascript">

The whole code is on this plunker : http://plnkr.co/edit/eWBi9uPVX5tJWwTsCVOd?p=preview

bleyk
  • 799
  • 3
  • 14
  • 41
  • This question has already been answered a handful of times, most notably here: http://stackoverflow.com/questions/2897619/using-html5-javascript-to-generate-and-save-a-file – Rex M Jan 12 '16 at 02:18
  • @RexM sorry I saw that already but I can't seem to understand it. I'm new in angular – bleyk Jan 12 '16 at 02:20
  • angular is just Javascript, nothing special. Take any of the solutions, put them in a Javascript function, and call the function from ng-click. – Rex M Jan 12 '16 at 02:29
  • @RexM I still cant get it. If its not too much can you give me a sample demo? – bleyk Jan 12 '16 at 02:45
  • I have forked your plunker and modified it. see http://plnkr.co/edit/GDoPUhvbQCe0vUuUDXhR?p=preview – sdfacre Jan 12 '16 at 04:07
  • thanks @sdfacre but as I click the button the dialog box that shows is for open file and for save as . How can I make the dialog box opening is for save as? – bleyk Jan 12 '16 at 04:41
  • 1
    do I need to use factory, directives and other stuffs? – bleyk Jan 12 '16 at 08:22
  • 1
    bleyk, I am also getting the open dialogbox instead of saveas, please share the code if you have for save as. Thank you – unknown Oct 29 '19 at 07:54
  • @sdfacre, could you please help me – unknown Oct 29 '19 at 07:58

0 Answers0