/**
 * The image controller
 * 
 * @param {$scope} $scope The $scope service from angular
 */
mainApp.controller('imageCtrl', ['$scope', 'Image', 'Loading', 'Identity', function ($scope, Image, Loading, Identity)
{

	var callbackTest=function(){
		$scope.images=Image.getData().images;
		Loading.stop();
	};

	
	if(Identity.isAlreadyLogin()){

		if(Image.getData().images==null){
			Loading.start();
			Image.getImages(callbackTest);
		}
		else{
			callbackTest();
		}

	}	
}]);