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