0

I am trying to loop through an array object retrived from Firebase:

   var announcementsRef = new Firebase(FIREBASE_URL+'/annoucements');
   $scope.announcements =  $firebaseObject(announcementsRef);

I display it in console : image.

I tried to display the first object message like this

console.log($scope.announcements[1].message).

But it does not shows me
How can I solve this ?

2
  • Is it an array, or an object? It makes difference. Commented Feb 26, 2016 at 12:24
  • Using console.log() for debugging AngularFire data loading is not recommended. To see your announcements, make them visible in your HTML with <pre>{{ announcements | json}}</pre>. That pattern is recommended in the Intro to AngularFire section of the documentation. Commented Feb 27, 2016 at 8:16

1 Answer 1

1

If what's stored on Firebase it's an array, the way to use it is with $firebaseArray(ref);

Check the guide for more info https://www.firebase.com/docs/web/libraries/angular/guide/synchronized-arrays.html

Sign up to request clarification or add additional context in comments.

1 Comment

@CarmenMitruStudent why do you consider this non help? It is actually exactly what you need to do. If the data at the location is a collection of objects, you need to wrap it in $firebaseArray() and bind that to your $scope.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.