So I'm developing a native OSX/Windows app using Atom-shell and AngularJS. I'm trying to open a file save dialog.
Atom-shell has a "dialog" API:
I can use this API from my atom-shell setup JS file (main.js):
But that doesn't do me any good - it just opens a file dialog when I first run the app through Atom-shell. How do I access this dialog API from within my AngularJS app? I'm basically needing a "download CSV file" button. When I try to require 'dialog' in my angular app (app.js), I get "module not found" error. This is my AngularJS app index.html:
<!DOCTYPE html> <html ng-app="socialWorkerProApp"> <head> <title>Social Worker Pro</title> <script src="node_modules/angular/angular.js"></script> <script src="node_modules/angular-route/angular-route.js"></script> <script src="node_modules/angular-sanitize/angular-sanitize.min.js"></script> <script src="bower_components/angular-native-picker/build/angular-datepicker.js"></script> <script src="js/app.js"></script> ...
When I try adding this line to app.js:
var dialog = require('dialog');
I get the "module not found" error, which makes sense because it's not a nodejs module, it's within Atom-shell. So how do I access those methods from within my AngularJS app?
Here's the download CSV button:
<button ng-click="downloadClientsCSV()" class="btn btn-primary"><i class="icon ion-android-download"></i>Download CSV</button>
And downloadClientsCSV() generates a csv file, and should pop open a file save dialog. I've tried using the "hidden input element, click()" method, and also tried the "window.open(data...)" method, which works in a web app environment, but Atom-shell doesn't like it - just opens a blank browser window.