How can I ng-repeat a firebase Array?


In a Firebase DB I’m storing “events” and “users”. Users can have favorite events, to manage them I only store the event’s id in the favorite user’s DB location. So to grab favorite events informations, I need to firstable grab the event id and then go to the DB events location, to collect all the datas I need.

enter image description here


I would like to store in an Array all the favorite events informations (each event would be an Object with inside it : “key” : “value”), to use that Array in my HTML view and print the informations. But it doesn’t work the way I coded it… :frowning:

   // This ref is too grab favorite event id (in my case only 2) in the user DB location
    var refUserFavoris = firebase.database().ref().child("users/"+user.uid+"/events/favoris"); 
    $scope.favorisTmp = $firebaseArray(refUserFavoris);

    // This shows one array, with two objects (wich are my two user's favorite events) wich include ids

    // This is to load the objects and with the foreEach, grab there ids to use them in the next ref call
            angular.forEach($scope.favorisTmp, function(favoris) 
                // This shows two lines : the id of each object

                // Call a new ref to reach the event informations (in a different location of the DB) using the previous id
                    // Attempt to store events datas for each id I have (in my case, only two)
                        var favSnap = favorisSnap.val();

                        // This shows a lot of "undefined" lines, wich I don't want. I would like two objects, with all informations inside

                        // $scope.favorisF is an Array that I would like to use in a ng-repeat to print all datas for each event
                        // For now this doesn't show anything
                        $scope.favorisF = favSnap;

                    // If using favSnap out of the previous function, I got a "favSnap" is undifined error
<ion-item ng-repeat="f in favorisF" class="item-avatar">