1
votes

I have an ng-repeat which is connected to a firebaseArray which is an index of a user's doc Ids. I want to display a list of their docs with additional info for each one, e.g. it's title and description.

My firebase structure is:

+users
  - userId1
    -theirDocs
         -docId1: true
         -docId2: true

+docs
  -docId1
      - tile
      - description
      - url
   -docId2
     - etc etc

I've tried everything and still can't get this to work, it seems a pretty common use case. I've tried using a function that calls a firebaseObject each time. I've tried using a separate controller. I've tried a directive, I've even tried using firebase.utils library (I think out of date now).

Can anyone recommend the best way to do this using AngularFire? Thanks in advance!

1

1 Answers

0
votes

It would be better to see a code snippet as to fully understand what you've tried first of all, as it's difficult to determine where the issues lie. That being said, as long as your rules are not preventing this, you may need to wait for the data to download using $loaded function beforehand.

EXAMPLE

This example is clearly available by following this link, yet here is an example for further clarity:

var yourFirebaseReference = firebase.database().ref("REPLACE WITH YOUR FIREBASE BRANCH HERE");
var data = $firebaseArray(yourFirebaseReference);
data.$loaded().then(function(x) {
    console.log(data) // Example, you can do what you want with your 'data' now as the data has loaded
    x === data; // true
}).catch(function(error) {
    console.log("Error:", error);
});