added comments, fixed if sytax, fixed console log

This commit is contained in:
Lucas Pleß 2022-09-04 14:17:54 +02:00
parent 2b84618d1e
commit d17c24bde7
1 changed files with 4 additions and 2 deletions

View File

@ -5,6 +5,7 @@ var gpower;
angular.module('roomstateapp.controllers', []).
controller('StatusCtrl', function ($scope, $http, Socket) {
// on page load request current data via simple API.
$http({
method: 'GET',
url: '/api/simple/v2'
@ -18,8 +19,9 @@ angular.module('roomstateapp.controllers', []).
console.log("error getting data");
});
// while page is loaded, new data will arrive via Websocket.
Socket.on('sdata', function(message) {
console.log("received data from server: " + message.data.names);
console.log("received data from server: " + JSON.stringify(message.data));
$scope.simple = message.data;
gpower.refresh(message.data.power);
});
@ -61,7 +63,7 @@ angular.module('roomstateapp.services', []).
angular.module('roomstateapp.statusfilter', []).filter('statustostring', function() {
return function(input) {
return input == true ? 'geöffnet' : input == false ? 'geschlossen' : 'unbekannt';
return input === true ? 'geöffnet' : input === false ? 'geschlossen' : 'unbekannt';
};
});