25 lines
654 B
JavaScript
25 lines
654 B
JavaScript
|
'use strict';
|
||
|
|
||
|
|
||
|
angular.module('roomstateapp.controllers', []).
|
||
|
controller('StatusCtrl', function ($scope, $http, Socket) {
|
||
|
|
||
|
$http({
|
||
|
method: 'GET',
|
||
|
url: '/api/simple/v2'
|
||
|
}).
|
||
|
success(function (data, status, headers, config) {
|
||
|
$scope.simple = data;
|
||
|
}).
|
||
|
error(function (data, status, headers, config) {
|
||
|
//$scope.name = 'Error!'
|
||
|
console.log("error getting data");
|
||
|
});
|
||
|
|
||
|
Socket.on('sdata', function(message) {
|
||
|
console.log("received data from server: " + message.data.names);
|
||
|
$scope.simple = message.data;
|
||
|
});
|
||
|
|
||
|
});
|