summaryrefslogtreecommitdiff
path: root/client/js/controllers/image/image.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/js/controllers/image/image.js')
-rw-r--r--client/js/controllers/image/image.js34
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();
+ }
+ }
+ }]);