Skip to content

Commit 3cee34f

Browse files
authored
simpler code example
1 parent 8ce98ff commit 3cee34f

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

docs/version-5-upgrade.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,8 @@ constructor(afDb: AngularFireDatabase) {
4141
### 5.0
4242
```ts
4343
constructor(afDb: AngularFireDatabase) {
44-
afDb.list('items').snapshotChanges().map(action => {
45-
const arr = [];
46-
action.forEach(e => {
47-
const $key = e.key;
48-
arr.push({ $key, ...e.payload.val() });
49-
});
50-
return arr;
44+
afDb.list('items').snapshotChanges().map(actions => {
45+
return actions.map(action => ({ $key: action.key, ...action.payload.val() }));
5146
}).subscribe(items => items.forEach(item => console.log(item.$key)));
5247
}
5348
```

0 commit comments

Comments
 (0)