File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 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
3434### 4.0
3535``` ts
3636constructor (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+ });
3840}
3941```
4042
4143### 5.0
4244``` ts
4345constructor (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+ });
4951}
5052```
5153
You can’t perform that action at this time.
0 commit comments