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();
};