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
2016-01-21 22:08:27 +01:00

45 lines
No EOL
849 B
JavaScript

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');
}
o.irTest = function ( ) {
return $http.get('/irTest');
}
return o;
}]);
app.controller('MainCtrl', ['$scope', 'arduino', function ($scope, arduino){
$scope.toggleLight = function(){
arduino.toggleLight();
};
$scope.irTest = function(){
arduino.irTest();
};
}]);