35 lines
No EOL
706 B
JavaScript
35 lines
No EOL
706 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');
|
|
}
|
|
|
|
return o;
|
|
}]);
|
|
|
|
app.controller('MainCtrl', ['$scope', 'arduino', function ($scope, arduino){
|
|
|
|
$scope.toggleLight = function(){
|
|
|
|
arduino.toggleLight();
|
|
|
|
};
|
|
|
|
}]); |