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
docs(lists): Fixing various typos and improving readability
Updated Tutorial to go in flow with the previous sections. export was missing, selector was not correct. removed moduleId, which could have thrown errors for new users. Component name has been corrected.
Copy file name to clipboardExpand all lines: docs/3-retrieving-data-as-lists.md
+21-14Lines changed: 21 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,27 +9,33 @@ The guide below demonstrates how to retrieve, save, and remove data as lists.
9
9
**Make sure you have bootstrapped your application for AngularFire2. See the Installation guide for bootstrap setup.**
10
10
11
11
AngularFire is an injectable service, which is injected through the constructor of your Angular component or `@Injectable()` service.
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
+
14
+
Replace your `/src/app/app.component.ts` from previous step to look like below.
12
15
13
16
```ts
14
-
import {Component} from'@angular/core';
15
-
import {AngularFire} from'angularfire2';
17
+
import {Component} from'@angular/core';
18
+
import {AngularFire} from'angularfire2';
16
19
17
20
@Component({
18
-
selector: 'app',
19
-
templateUrl: 'app/app.html',
21
+
selector: 'app-root',
22
+
templateUrl: 'app.component.html',
23
+
styleUrls: ['app.component.css']
20
24
})
21
-
classAppComponent {
25
+
exportclassAppComponent {
22
26
constructor(af:AngularFire) {
23
-
27
+
24
28
}
25
29
}
26
30
```
27
31
32
+
In this section, we're going to modify the `/src/app/app.component.ts` to retreive data as list, but before that let's look at ways around how to bind to a list.
33
+
28
34
## Create a list binding
29
35
30
36
Data is retrieved through the `af.database` service.
To get the list in realtime, create a list binding as a property of your component or service.
55
61
Then in your template, you can use the `async` pipe to unwrap the binding.
56
62
63
+
Update `/src/app/app.component.ts` to import `FirebaseListObservable` from angularfire2 and iterate thru the list once data is retrieved. Also note the change in attribute `templateUrl` to inline `template` below.
0 commit comments