diff options
Diffstat (limited to 'alias-angular/app/js/controllers.js')
| -rw-r--r-- | alias-angular/app/js/controllers.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/alias-angular/app/js/controllers.js b/alias-angular/app/js/controllers.js index d487fdf..162f794 100644 --- a/alias-angular/app/js/controllers.js +++ b/alias-angular/app/js/controllers.js @@ -2,23 +2,32 @@ /* App Controllers */ function ConnectCtl($scope, StropheSrv, $log, $rootScope) { + $scope.status = ""; function connect_callback(status){ if ( status == Strophe.Status.CONNECTING ) { $log.log('Strophe is connecting.'); + $scope.status = "Connecting"; } else if ( status == Strophe.Status.CONNFAIL ) { $log.log('Strophe failed to connect.'); + $scope.status = "Failed"; } else if ( status == Strophe.Status.DISCONNECTING ) { $log.log('Strophe is disconnecting.'); + $scope.status = "Disconnecting"; } else if ( status == Strophe.Status.DISCONNECTED ) { $log.log('Strophe is disconnected.'); + $scope.status = "Disconnected"; } else if ( status == Strophe.Status.CONNECTED ) { $log.log('Strophe is connected.'); + $scope.status = "Connected"; $rootScope.$broadcast('connected', true); } }; $scope.login = function () { StropheSrv.login($scope.username, $scope.password, connect_callback); }; + $scope.disconnect = function() { + StropheSrv.disconnect(); + }; } ConnectCtl.$inject = ['$scope', 'StropheSrv', '$log', '$rootScope']; |
