Skip to content

Commit 658517b

Browse files
aortyldavideast
authored andcommitted
docs(3-retrieving-data-as-lists.md): clarity and FirebaseListObservable correction (#370)
* docs(3-retrieving-data-as-lists.md): example clarity Update component methods to be prefixed by 'Item'. This prevents collisions, and improves readability, in situations where the previous step's example is combined with this one. Update field being updated from size to text. This allows the updates to be immediately observable without any additional code, since item.size was not being displayed. * docs(3-retrieving-data-as-lists.md): FirebaseListObservable correction Update 'Observable' and 'FirebaseObjectObservable' to 'FirebaseListObservable' where needed.
1 parent b127239 commit 658517b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/3-retrieving-data-as-lists.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ import {AngularFire, FirebaseListObservable} from 'angularfire2';
6969
`,
7070
})
7171
class AppComponent {
72-
items: Observable<any>;
72+
items: FirebaseListObservable<any>;
7373
constructor(af: AngularFire) {
7474
this.items = af.database.list('/items');
7575
}
@@ -80,7 +80,7 @@ class AppComponent {
8080

8181
### API Summary
8282

83-
The table below highlights some of the common methods on the `FirebaseObjectObservable`.
83+
The table below highlights some of the common methods on the `FirebaseListObservable`.
8484

8585
| method | |
8686
| ---------|--------------------|
@@ -152,13 +152,13 @@ import { AngularFire, FirebaseListObservable, FirebaseObjectObservable } from 'a
152152
template: `
153153
<ul>
154154
<li *ngFor="let item of items | async">
155-
<input type="text" #updatesize [value]="item.text" />
156-
<button (click)="update(item.$key, updatesize.value)">Update</button>
155+
<input type="text" #updatetext [value]="item.text" />
156+
<button (click)="updateItem(item.$key, updatetext.value)">Update</button>
157157
<button (click)="deleteItem(item.$key)">Delete</button>
158158
</li>
159159
</ul>
160160
<input type="text" #newitem />
161-
<button (click)="add(newitem.value)">Add</button>
161+
<button (click)="addItem(newitem.value)">Add</button>
162162
<button (click)="deleteEverything()">Delete All</button>
163163
`,
164164
})
@@ -167,11 +167,11 @@ export class RcTestAppComponent {
167167
constructor(af: AngularFire) {
168168
this.items = af.database.list('/messages');
169169
}
170-
add(newName: string) {
170+
addItem(newName: string) {
171171
this.items.push({ text: newName });
172172
}
173-
update(key: string, newSize: string) {
174-
this.items.update(key, { size: newSize });
173+
updateItem(key: string, newText: string) {
174+
this.items.update(key, { text: newText });
175175
}
176176
deleteItem(key: string) {
177177
this.items.remove(key);

0 commit comments

Comments
 (0)