istic-openstack/client/js/controllers/home/main.js
2016-03-01 20:51:08 +01:00

28 lines
582 B
JavaScript

/**
* The home controller
*
* @param {$scope} $scope The $scope service from angular
*/
mainApp.controller('homeCtrl', [ '$scope', 'Compute', '$rootScope', function ($scope, Compute, $rootScope)
{
var callMeAfterGetMachines=function(data){
$scope.machines=Compute.getData().machines;
}
Compute.pullMachines(callMeAfterGetMachines);
$scope.raiseShowMachineDetailsEvent=function(id){
var callback=function(){
var data=Compute.getData();
$rootScope.$broadcast("showMachineDetailsEvent", data.machines[id]);
}
Compute.pullMachines(callback);
}
}]);