Using angulafire it was possible to extract the pushid file before saving it to the database:
myModelDto.key = dbRef.push().key;
This was convenient since I could store the firebase key as a property of my model.
Now with angularfire2 this is not possible in a simple / easy way:
constructor(private angFire: AngularFire) { this.placeRef$ = angFire.database.list('/places'); } insertPlace = (place: IPlace): firebase.Thenable<IPlace> => { return this.placeRef$.push(place) .then(item => { place.id = item.key; this.placeRef$.update(item.key, place) });
Therefore, I am wondering if I am approaching firebase in the wrong way (wanting for convenience a key property bound to my model to be bound) or if there is a better way to add pushid to newly added records.
source share