/*
 * mainApp Controller
 */



mainApp.controller('statusCtrl', function ($scope,$interval,$sce)
{
    
    // Update status every 2 seconds
    $interval(function(){   
        var status=identity.fetchStatus();
        $scope.username=status[1];
        $scope.lastconnection=status[2];
        if(status[0] == "1"){
            $scope.connection=$sce.trustAsHtml("<span style=\"color:green;\">Online</span>");
        }
        else{
            $scope.connection=$sce.trustAsHtml("<span style=\"color:red;\">Offline</span>");
        }
    }, 2000);



     
     
});