Skip to content

Commit 41c9086

Browse files
mukesh51davideast
authored andcommitted
docs(database): Updated 4. Querying lists (angular#572)
Updated the Query list Section to bring in consistency across other pages. Removed ModuleId to avoid errors. updated Selector, Component name. Added a sample data set at the end from completion point of view.
1 parent 2471f7d commit 41c9086

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

docs/4-querying-lists.md

+20-4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ re-run queries when the observable emits a new value.
5252

5353
This is the magic of AngularFire2.
5454

55+
An RxJS Subject is imported below. A Subject is like an Observable, but can multicast to many Observers. Subjects are like EventEmitters: they maintain a registry of many listeners. See, [What is a Subject](http://reactivex.io/rxjs/manual/overview.html#subject) for more information.
56+
5557
```ts
5658
const subject = new Subject(); // import {Subject} from 'rxjs/Subject';
5759
const queryObservable = af.database.list('/items', {
@@ -81,8 +83,7 @@ import { AngularFire, FirebaseListObservable, FirebaseObjectObservable } from 'a
8183
import { Subject } from 'rxjs/Subject';
8284

8385
@Component({
84-
moduleId: module.id,
85-
selector: 'app',
86+
selector: 'app-root',
8687
template: `
8788
<ul>
8889
<li *ngFor="let item of items | async">
@@ -97,7 +98,7 @@ import { Subject } from 'rxjs/Subject';
9798
</div>
9899
`,
99100
})
100-
export class RcTestAppComponent {
101+
export class AppComponent {
101102
items: FirebaseListObservable<any[]>;
102103
sizeSubject: Subject<any>;
103104

@@ -116,4 +117,19 @@ export class RcTestAppComponent {
116117
}
117118
```
118119

119-
###[Next Step: User Authentication](5-user-authentication.md)
120+
+**To run the above example as is, you need to have sample data in you firebase database with the following structure:"**
121+
122+
```ts
123+
-|items
124+
-|item1
125+
-|size: small
126+
-|text: sample small text
127+
-|item2
128+
-|size: medium
129+
-|text: sample medium text
130+
-|item3
131+
-|size: large
132+
-|text: sample large text
133+
```
134+
135+
###[Next Step: User Authentication](5-user-authentication.md)

0 commit comments

Comments
 (0)