jgrenon / angular-desktop-app

This is a simple application skeleton to create desktop application using AngularJS. This application is using node-webkit as our desktop host, bower to install client-side libraries as well as normal npm modules as supported by node-webkit.
MIT License
237 stars 57 forks source link

Basic node-webkit service #6

Closed talss89 closed 10 years ago

talss89 commented 10 years ago

Exposes nw.gui and main window.

Example

define(['./module'], function(controllers) {
    'use strict';

    controllers.controller('MyCtrl', ['$scope', 'nwService', function($scope, nwService) {

            // Minimize the main window
            nwService.window.minimize();

            // After 1 second, maximize the window
            setTimeout(function(){nwService.window.maximize();}, 1000);

            // When the window is closed, ask for confirmation before actually closing
            nwService.window.on('close', function() {
                if (confirm("Do you really want to close the window?"))
                    nwService.window.close(true);
            });

        }]);
});