Access a Firebase Document's ID Even when It's Not Stored in the Document with angularfire

InstructorJorge Vergara

Share this video with your friends

Send Tweet

There are 2 different ways to get a document's ID when using @angular/fire.

You can add the parameter { idField: 'id' } to your collection when using the collectionData() observable.

You can also use the observable collectionChanges() and access the internal metadata of the document to manually get the ID and add it to the resulting object.

Code sample: https://github.com/javebratt/angularfire-idField