Advertisement
fabiobiondi

Firestore - get key

Mar 27th, 2018
538
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // template
  2. <li class="text" *ngFor="let item of items | async">
  3.       {{item.title}} -- {{ item.key}}
  4. </li>
  5.  
  6. // typescript
  7. this.items = this.itemsCollection.snapshotChanges()
  8.       .map(actions => {
  9.         return actions.map(action => ({ $key: action.payload.doc.id, ...action.payload.doc.data() }));
  10.       });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement