You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/3-retrieving-data-as-lists.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
# 3. Retrieving data as lists
2
2
3
3
> AngularFire2 synchronizes data as lists using the `FirebaseListObservable`.
4
-
The `FirebaseListObservable` is not created by itself, but through the `AngularFire.database`service.
4
+
The `FirebaseListObservable` is not created by itself, but through the `AngularFire.database`module.
5
5
The guide below demonstrates how to retrieve, save, and remove data as lists.
6
6
7
-
## Injecting the AngularFire service
7
+
## Injecting the AngularFireDatabase module
8
8
9
9
**Make sure you have bootstrapped your application for AngularFire2. See the Installation guide for bootstrap setup.**
10
10
11
-
AngularFire is an injectable service, which is injected through the constructor of your Angular component or `@Injectable()` service.
11
+
AngularFireDatabase is an injectable module, which is injected through the constructor of your Angular component or `@Injectable()` service.
12
12
In the previous step, we modified the `/src/app/app.component.ts` to retrieve data as object. In this step, let's start with a clean slate.
13
13
14
14
Replace your `/src/app/app.component.ts` from previous step to look like below.
@@ -92,9 +92,9 @@ The table below highlights some of the common methods on the `FirebaseListObserv
92
92
93
93
| method ||
94
94
| ---------|--------------------|
95
-
| push(value: any) | Creates a new record on the list, using the Realtime Database's push-ids. |
96
-
| update(keyRefOrSnap: string) | Firebase | AFUnwrappedSnapshot, value: Object) | Updates an existing item in the array. Accepts a key, database reference, or an unwrapped snapshot. |
97
-
| remove(key: string?) | Deletes the item by key. If no parameter is provided, the entire list will be deleted. |
95
+
|`push(value: any)`| Creates a new record on the list, using the Realtime Database's push-ids. |
96
+
|`update(keyRefOrSnap: string)`| Firebase | AFUnwrappedSnapshot, value: Object) | Updates an existing item in the array. Accepts a key, database reference, or an unwrapped snapshot. |
97
+
|`remove(key: string?)`| Deletes the item by key. If no parameter is provided, the entire list will be deleted. |
98
98
99
99
## Returning promises
100
100
Each data operation method in the table above returns a promise. However,
@@ -194,8 +194,8 @@ Data retrieved from the object binding contains special properties retrieved fro
194
194
195
195
| property ||
196
196
| ---------|--------------------|
197
-
| $key | The key for each record. This is equivalent to each record's path in our database as it would be returned by `ref.key()`.|
198
-
| $value | If the data for this child node is a primitive (number, string, or boolean), then the record itself will still be an object. The primitive value will be stored under `$value` and can be changed and saved like any other field.|
197
+
|`$key`| The key for each record. This is equivalent to each record's path in our database as it would be returned by `ref.key()`.|
198
+
|`$value`| If the data for this child node is a primitive (number, string, or boolean), then the record itself will still be an object. The primitive value will be stored under `$value` and can be changed and saved like any other field.|
199
199
200
200
## Retrieving the snapshot
201
201
AngularFire2 unwraps the Firebase DataSnapshot by default, but you can get the data as the original snapshot by specifying the `preserveSnapshot` option.
0 commit comments