This repository has been archived on 2024-01-30. You can view files and clone it, but cannot push or open issues or pull requests.
trev/nodejs/public/javascripts/angularApp.js

35 lines
706 B
JavaScript
Raw Normal View History

2016-01-12 17:49:13 +01:00
var app = angular.module('autome', ['ui.router']);
app.config(['$stateProvider', '$urlRouterProvider',function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('home', {
url: '/home',
templateUrl: '/home.html',
controller: 'MainCtrl',
});
$urlRouterProvider.otherwise('home');
}]);
app.factory('arduino', ['$http', function($http, auth){
var o = {};
o.toggleLight = function ( ) {
return $http.get('/toggleLight');
}
return o;
}]);
app.controller('MainCtrl', ['$scope', 'arduino', function ($scope, arduino){
$scope.toggleLight = function(){
arduino.toggleLight();
2016-01-12 17:49:13 +01:00
};
}]);