35 lines
707 B
JavaScript
35 lines
707 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.test = 'Hello World!';
|
||
|
|
||
|
$scope.toggleLight = function(){
|
||
|
|
||
|
|
||
|
};
|
||
|
|
||
|
}]);
|