diff options
| author | Loic GUEGAN <loic@Manzerbredes.home> | 2016-04-17 18:50:05 +0200 |
|---|---|---|
| committer | Loic GUEGAN <loic@Manzerbredes.home> | 2016-04-17 18:50:05 +0200 |
| commit | bb1598713c0b6bbe39209c14681c759ab9907edc (patch) | |
| tree | 1483ca31662258cfb570ec736e85d63ae48627cc /client/js/controllers/image/image.js | |
| parent | 968eda48cc8f3af2214e347e83937086c5e93ad4 (diff) | |
Clean code, add comment etc..
Diffstat (limited to 'client/js/controllers/image/image.js')
| -rw-r--r-- | client/js/controllers/image/image.js | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/client/js/controllers/image/image.js b/client/js/controllers/image/image.js index d9a9c06..d0578d7 100644 --- a/client/js/controllers/image/image.js +++ b/client/js/controllers/image/image.js @@ -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(); + } + } + }]); |
