Skip to content

Retrieving list data with items id #1562

Closed
@loicmarie

Description

@loicmarie

I am very new to AngularFire. Trying to accomplish something similar to Angular ToH tutorial (e.g. retrieving/displaying a list and accessing item details by id) using AngularFireDatabase, the only way I found was:

  1. Retrieving list keys with snapshotChanges()
  2. Retrieving list values with valueChanges() using fetched keys
  3. Adding manually corresponding keys to items and then pushing it

I have been looking for days for a way to do this with a single request, with no result. Finally, I found a solution in #199 (closed):
At the time of item creation:

  1. Create manually pushId with createPushId() method (could not find it in documentation)
  2. Add pushId as item parameter
  3. Push item in list

If I missed something in the documentation, I apologize for this issue. If not, I am very surprised that there is no simple way to retrieve items in a list with their reference.

If I am not wrong about it, I would either createPushId() to be documented or a simple way to retrieve list with items id. But using createPushId implies key redundancy in database, so it would not be the best solution in my opinion.

Version info

Angular: angular/cli@1.7.4

Firebase: 4.12.1

AngularFire: 5.0.0-rc.5-next

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions