Skip to content

Instantly share code, notes, and snippets.

@sbruchmann
Last active December 15, 2015 23:29
Show Gist options
  • Save sbruchmann/5341147 to your computer and use it in GitHub Desktop.
Save sbruchmann/5341147 to your computer and use it in GitHub Desktop.
node-webkit and Angular.js

Running a standalone app with node-webkit and Angular.js

After you have downloaded and installed node-webkit, create a directory on your hard-drive named myapp.

Place all files of this gist inside the created directory:

  • myapp/
    • app.js
    • index.html
    • package.json

Open your terminal and cd to myapp. Run node-webkit as explained on the node-webkit wiki.

function AppCtrl($scope) {
'use strict';
$scope.name = "world";
}
<!DOCTYPE html>
<html ng-app>
<head>
<meta charset="UTF-8" />
<title>My App</title>
</head>
<body>
<div ng-controller="AppCtrl">
<input ng-model="name" type="text">
<p>Hello, {{name}}!</p>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script>
<script src="app.js"></script>
</body>
</html>
{
"name": "angularjs-desktop-example",
"version": "0.0.0",
"main": "index.html"
}
@roblevintennis
Copy link

Nice share .. thanks man!

@ProZachJ
Copy link

will you be able to use node require to bring nodejs code into your angular services?

@sbruchmann
Copy link
Author

@ProZachJ Yes, that is possible with node-webkit.

@MaestroJurko
Copy link

i have a htm5 navigation in angularjs.

$locationProvider.html5Mode(true);
$routeProvider
.when("/te/:theme/:element", {action: "test"})
.otherwise({action: "default"});

but when using it is very strange app://te/te/theme/element. I dont know why there is another /te in request?

@MaestroJurko
Copy link

$routeChangeSuccess or $routeChangeStart is not emited. does anyone have the same problem?

I am using AngularJS, and it appears that something doesnt work with ngHref.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment