Angularjs and HTML5 for desktop application CRUD operation featuring node-MySQL Using NWJS

  • )’); }; mysql.update = function (data) { return result([data.name, data.position, data.gol, data.id], ‘update player set name=?,position=?,gol=? where id=?’); }; mysql.delete = function (id) { var def = $q.defer(); connection.query(‘delete from player where id=?’, [id], function (err, res) { if (err) { def.reject(err); } else { def.resolve(res.affectedRows); } }); return def.promise; }; function result(param, query) { var def = $q.defer(); connection.query(query, param, function (err, rows) { if (err) { def.reject(err); } else { def.resolve(rows); } }); return def.promise; }; return mysql; }); })();
  • (function () { ‘use strict’; var app = angular.module(‘controllers’, []); app.controller(‘halaCtrl’, function ($scope, halaService) { $scope.datas = []; $scope.button = ‘Save’; showData(); function showData() { halaService.select().then(function (response) { $scope.datas = [].concat(response); }); } function clear() { showData(); $scope.button = ‘Save’; $scope.player = ”; $scope.search = ”; }; $scope.refresh = function () { clear(); }; $scope.save = function () { if ($scope.button === ‘Save’) { halaService.insert($scope.player).then(function (response) { $scope.player = response.data; alert(‘Saving Player Success…’
  • 13 observations on ” Angularjs and HTML5 for desktop application CRUD operation featuring node-MySQL Using NWJS “
  • im using node-mysql and build to desktop using NWJS .
  • Create the database using mysql

ok, after test and install tools you can install node-mysql and q in folder nwjs/your apps. just run in command prompt :

@alessandronizzo: Angularjs and HTML5 for desktop application CRUD operation featuring node-MySQL Using NWJS | Rudy On 007

hay, this is a apps using angularJS,html5 and css. im using node-mysql and build to desktop using NWJS.

so, if you developer then using install

node.js for install any package with node_module to embed your project/apps.

i’m using netbeans for create apps .

create new project html5 appplication

location folder to nwjs folder

just edit package.json in the folder nwjs

modif a simple html file and run nw.exe this example :

yes success load html on the desktop.

ok, after test and install tools you can install node-mysql and q in folder nwjs/your apps. just run in command prompt :

now, create the database using mysql

after create database you can make a file javascript in the netbeans your project

download the angular.js from this https://angularjs.org/.

index.html

in angular js using services and controller for require mysql. you can routing your view via $state.

app.js

this is a service to load mysql module from node_module

services.js

control your services in the controllers.js and render to html in the view.

run nw.exe and look like this.

ok, see you to next time.

Angularjs and HTML5 for desktop application CRUD operation featuring node-MySQL Using NWJS

You might also like More from author

Comments are closed, but trackbacks and pingbacks are open.