Working connect/disconnect handlers and status indicator

This commit is contained in:
AlexKvazos
2015-04-28 11:19:36 -05:00
parent 542ae1f549
commit 793fe3e162
7 changed files with 55 additions and 10 deletions
+30
View File
@@ -0,0 +1,30 @@
/**
* Connect Controller
*/
module.exports = function($scope, socket) {
$scope.connected = false;
socket.on('bot:connect', function(data) {
$scope.$apply(function() {
$scope.host = data.host;
$scope.port = data.port;
$scope.username = data.username;
$scope.connected = true;
});
});
socket.on('bot:disconnect', function() {
$scope.$apply(function() {
$scope.connected = false;
});
})
socket.on('disconnect', function() {
$scope.$apply(function() {
$scope.connected = false;
});
});
};