|
'use strict';
/**
* @ngdoc function
* @name domainManagerApp.controller:AboutCtrl
* @description
* # AboutCtrl
* Controller of the domainManagerApp
*/
angular.module('domainManagerApp.domainsList', ['ui.bootstrap', 'firebase', 'domainManagerApp.domainsData'])
.controller('DomainsListController',['$scope', '$firebase', 'Domains', '$rootScope', function ($scope, $firebase, Domains, $rootScope) {
// $http({
// method: 'GET',
// url: '/scripts/data.json'
// }).success(function(data) {
// $scope.domains = data.domains;
// });
$scope.domains = Domains.get();
$rootScope.$on('domains:loaded', function(domain) {
if(!$scope.$$phase) {
$scope.$apply(function(){
$scope.domains = Domains.get();
});
}
});
$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;
}
}]);
// // 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);
// });
|