I have a simple AngularJS application, i have the page with albums at the Albums.html page, after click to album i redirect to AlbumPhotos.html and send $http.post request to server and get all photos of album from server:
//Empty Photo Array
$scope.AllPhotosOfAlbumArray = [];
// Get All Photos Of Album
$scope.getAlbumPhotos = function (albumId) {
console.log(albumId);
logicOfMyApp.getAllPhotosOfALmubFromSrverFunc(albumId).then(function (photos) {
$scope.AllPhotosOfAlbumArray = photos;
console.log($scope.AllPhotosOfAlbumArray);
});
};
getAllPhotosOfALmubFromSrverFunc() method code:
getAllPhotosOfALmubFromSrverFunc: function(albumId)
{
var photosPromise = $q.defer();
var req = {
method: 'POST',
url: '/api/getPhotos',
data: albumId
};
$http(req).success(function(res) {
return photosPromise.resolve(res)
}).error(function(error){
return photosPromise.reject(error);
});
return photosPromise.promise;
}
But when i trying display data from $scope.AllPhotosOfAlbumArray use ng-repeat directive at the page:
<!--Display all Photos Of Album-->
<div ng-repeat="photo in AllPhotosOfAlbumArray">
{{photo}}
</div>
it display nothing.
Maybe somebody knows how i can resolve it ?
Thanks for your answers!
