Do we need Angularfire2?

My use of Firebase is very limited and have always followed examples that use Angularfire2.

However I am seeing more and more articles where Angularfire2 is not used - see example below:

What advantages do we get from using Angularfire2?

I like Angularfire2 because of the Observable based interface to the Firestore database. But I guess you don’t need it if you’re happy with what the firebase-js-sdk offers you.

If you need to listen to a document or a list in real time (like a list of chat messages), AF is superb. If you only need to download once, you don’t need AF (or any Firebase product).

AFauth is the weakest part of AF from an Ionic perspectve. If you want to sign into Google+ for example, you can’t use AF, unless you’re on a desktop platform only. On the other hand, if you’re only doing email/password authentication, AFauth is great.

1 Like

I find the AFire API too restrictive and limited to play with Firebase. Or at least I am not able to figure things out out of the docs, source code or examples. So in the end fell back to the plain vanilla SDK which was actually quite easy

The RxJS extensions are indeed nice as @AaronSterling rightfully says, but even that you can do yourself if needed.

I had already planned to publish my attempt to simplify the AF API, but your comment here convinced me to finish today. Thread here, for what it’s worth.

So do I assume that the power of Angularfire2 is when you do the following:

In the page ts file:

constructor(public navCtrl: NavController, afDB: AngularFireDatabase) {
this.items = afDB.list(‘cuisines’).valueChanges();
}

and in the page HTML:

	<ion-item class="text" *ngFor="let item of items | async">

Yes, that is true…

I like it! I’m in the process of putting together an npm package myself that supplies functions for returning all extracted keys, all extracted references, snapshots, and raw data from Firestore nested collections.

It’s pretty much done. I’ll let you know when it’s published. Feel free to take what you will to add to what you’ve got, if you’d like to.

Basically, I extract an array of mapped keys to

promise<string[]>

Then use that to extract a mapped

promise<firebase.firestore.DocumentData[]>

And unwrap it.

It’s a little complex, but maybe another pair of eyes could help simplify it. Considering the nature of firestores reference, snapshot and document system, it may be as simple as possible though.

It’s also geared toward working with Behavior Subjects, so I’m not sure it’ll apply to what you put together. Either way I’ll give you a heads up.