Clean code, add comment etc..
This commit is contained in:
parent
968eda48cc
commit
bb1598713c
7 changed files with 251 additions and 232 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue