Is there a reason to use AngularFire to subscribe to a firebase if you're already using .onSnapshot?

Viewed 83

I'm studying a course on AngularFire and it's going over subscribing to firebase. However, doesn't .onSnapshot provide the same observable functionality? .onSnapshot updates my array with changes from firestore in realtime...so why would we use angularFire to subscribe if you can just use the .onSnapshot method?

1 Answers

AngularFire exists as a way of using firebase functionality in a way which generally suits angular programming better. All of AngularFire's functionality is just a wrapper over the equivalent functionality in the javascript firebase objects.

The major way in which AngularFire helps you is that is uses rxjs and thus returns the observables that angular likes so well. Angular is built around observables and in general things go well with observables.

So simply put what AngularFire gives you is an observable in place of the callback that you would get using firebase directly.

Related