I'm trying to retu a value from a nested function on my codes but it retu me undefined whenever i tried to display it. This is my codes:
var calculateAlbum = function (albumPath,albumName) {
retu photoService.getPhotos(albumPath,albumName)
.success(function (data){
var status = data.myphotos.status;
if(status == "ok"){
photoService.myphotosPhotoList()
.success(function(data){
$scope.allPhotoListTotal = {};
var getAllPhotoList = data.config.nas_sharing;
$scope.allPhotoListTotal = getAllPhotoList.count;
});
}
});
}
Retu a value:
calculateAlbum(albumPath,fileName).then(function(data) {
var gettotal = $scope.allPhotoListTotal;
console.log(gettotal);
});
After retuing value in a console. It send me undefined. What is the best approached for this?
