Clean code, add comment etc..

This commit is contained in:
Loic GUEGAN 2016-04-17 18:50:05 +02:00
parent 968eda48cc
commit bb1598713c
7 changed files with 251 additions and 232 deletions

View file

@ -4,23 +4,21 @@
* @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();
};
// Update view
var callMeAfterGetImage = function () {
$scope.images = Image.getData().images;
Loading.stop();
};
if(Identity.isAlreadyLogin()){
if(Image.getData().images==null){
Loading.start();
Image.getImages(callbackTest);
}
else{
callbackTest();
}
}
}]);
// If user is login try to retrieve data
if (Identity.isAlreadyLogin()) {
if (Image.getData().images == null) {
Loading.start();
Image.getImages(callMeAfterGetImage);
} else {
callMeAfterGetImage();
}
}
}]);