|
'use strict';
/**
* @ngdoc function
* @name domainManagerApp.controller:AboutCtrl
* @description
* # AboutCtrl
* Controller of the domainManagerApp
*/
angular.module('domainManagerApp.domains', ['ui.bootstrap', 'firebase'])
.controller('DomainsListController',['$scope', '$firebase', function ($scope, $firebase) {
// $http({
// method: 'GET',
// url: '/scripts/data.json'
// }).success(function(data) {
// $scope.domains = data.domains;
// });
$scope.domains = [];
// Get domain list from firebase
var ref = new Firebase("https://j1x-cpanel.firebaseio.com/domains");
ref.on("child_added", function(data) {
if(!$scope.$$phase) {
$scope.$apply(function(){
$scope.domains.push(data.val());
});
}
}, function (errorObject) {
console.log("The read failed: " + errorObject.code);
});
$scope.oneAtATime = false;
$scope.isOpen = false;
$scope.labelColor = function(status) {
if (status == "OK"){
var color = "label-success";
} else if (status == "DEAD") {
var color = "label-danger";
} else {
var color = "label-default";
}
return color;
}
}]);
|