File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -34,18 +34,20 @@ Calling `.valueChanges()` returns an Observable without any metadata. If you are
34
34
### 4.0
35
35
``` ts
36
36
constructor (afDb : AngularFireDatabase ) {
37
- afDb .object (' items/1' ).subscribe (item => console .log (item .$key ));
37
+ afDb .list (' items' ).subscribe (items => {
38
+ const allKeys = items .map (item => item .$key );
39
+ });
38
40
}
39
41
```
40
42
41
43
### 5.0
42
44
``` ts
43
45
constructor (afDb : AngularFireDatabase ) {
44
- afDb .object (' items/1 ' ).snapshotChanges ().map (action => {
45
- const $key = action .payload .key ;
46
- const data = { $key , ... action . payload . val () };
47
- return data ;
48
- }). subscribe ( item => console . log ( item . $key )) ;
46
+ afDb .list (' items' ).snapshotChanges ().map (actions => {
47
+ return actions . map ( action => ({ key: action .key , ... action . payload .val () })) ;
48
+ }). subscribe ( items => {
49
+ return items . map ( item => item . key ) ;
50
+ });
49
51
}
50
52
```
51
53
You can’t perform that action at this time.
0 commit comments