@@ -10,7 +10,7 @@ The `AngularFirestoreCollection` service is a wrapper around the native Firestor
1010``` ts
1111import { Component } from ' @angular/core' ;
1212import { AngularFirestore , AngularFirestoreCollection } from ' angularfire2/firestore' ;
13- import { Observable } from ' rxjs/Observable ' ;
13+ import { Observable } from ' rxjs' ;
1414
1515export interface Item { name: string ; }
1616
@@ -86,7 +86,7 @@ There are multiple ways of streaming collection data from Firestore.
8686``` ts
8787import { Component } from ' @angular/core' ;
8888import { AngularFirestore , AngularFirestoreCollection } from ' angularfire2/firestore' ;
89- import { Observable } from ' rxjs/Observable ' ;
89+ import { Observable } from ' rxjs' ;
9090
9191export interface Item { id: string ; name: string ; }
9292
@@ -135,8 +135,8 @@ export class AppComponent {
135135``` ts
136136import { Component } from ' @angular/core' ;
137137import { AngularFirestore , AngularFirestoreCollection } from ' angularfire2/firestore' ;
138- import { Observable } from ' rxjs/Observable ' ;
139- import ' rxjs/add/operator/map ' ;
138+ import { Observable } from ' rxjs' ;
139+ import { map } from ' rxjs/operators ' ;
140140
141141export interface Shirt { name: string ; price: number ; }
142142export interface ShirtId extends Shirt { id: string ; }
@@ -159,13 +159,13 @@ export class AppComponent {
159159 // .snapshotChanges() returns a DocumentChangeAction[], which contains
160160 // a lot of information about "what happened" with each change. If you want to
161161 // get the data and the id use the map operator.
162- this .shirts = this .shirtCollection .snapshotChanges ().map ( actions => {
163- return actions .map (a => {
162+ this .shirts = this .shirtCollection .snapshotChanges ().pipe (
163+ map ( actions => actions .map (a => {
164164 const data = a .payload .doc .data () as Shirt ;
165165 const id = a .payload .doc .id ;
166166 return { id , ... data };
167- });
168- } );
167+ }))
168+ );
169169 }
170170}
171171```
@@ -181,7 +181,8 @@ export class AppComponent {
181181``` ts
182182import { Component } from ' @angular/core' ;
183183import { AngularFirestore , AngularFirestoreCollection } from ' angularfire2/firestore' ;
184- import { Observable } from ' rxjs/Observable' ;
184+ import { Observable } from ' rxjs' ;
185+ import { map } from ' rxjs/operators' ;
185186
186187export interface AccountDeposit { description: string ; amount: number ; }
187188export interface AccountDepoistId extends AccountDeposit { id: string ; }
@@ -201,14 +202,13 @@ export class AppComponent {
201202 deposits: Observable <AccountDepositId []>;
202203 constructor (private readonly afs : AngularFirestore ) {
203204 this .depositCollection = afs .collection <AccountDeposit >(' deposits' );
204- this .deposits = this .depositCollection .stateChanges ([' added' ])
205- .map (actions => {
206- return actions .map (a => {
207- const data = a .payload .doc .data () as AccountDeposit ;
208- const id = a .payload .doc .id ;
209- return { id , ... data };
210- })
211- });
205+ this .deposits = this .depositCollection .stateChanges ([' added' ]).pipe (
206+ map (actions => actions .map (a => {
207+ const data = a .payload .doc .data () as AccountDeposit ;
208+ const id = a .payload .doc .id ;
209+ return { id , ... data };
210+ }))
211+ );
212212 }
213213}
214214```
@@ -224,7 +224,8 @@ export class AppComponent {
224224``` ts
225225import { Component } from ' @angular/core' ;
226226import { AngularFirestore , AngularFirestoreCollection } from ' angularfire2/firestore' ;
227- import { Observable } from ' rxjs/Observable' ;
227+ import { Observable } from ' rxjs' ;
228+ import { map } from ' rxjs/operators' ;
228229
229230export interface AccountLogItem { description: string ; amount: number ; }
230231export interface AccountLogItemId extends AccountLogItem { id: string ; }
@@ -244,14 +245,13 @@ export class AppComponent {
244245 accountLogs: Observable <AccountLogItemId []>;
245246 constructor (private readonly afs : AngularFirestore ) {
246247 this .accountLogCollection = afs .collection <AccountLogItem >(' accountLog' );
247- this .accountLogs = this .accountLogCollection .auditTrail ()
248- .map (actions => {
249- return actions .map (a => {
250- const data = a .payload .doc .data () as AccountLogItem ;
251- const id = a .payload .doc .id ;
252- return { id , ... data };
253- })
254- });
248+ this .accountLogs = this .accountLogCollection .auditTrail ().pipe (
249+ map (actions => actions .map (a => {
250+ const data = a .payload .doc .data () as AccountLogItem ;
251+ const id = a .payload .doc .id ;
252+ return { id , ... data };
253+ }))
254+ );
255255 }
256256}
257257```
@@ -272,7 +272,7 @@ There are three `DocumentChangeType`s in Firestore: `added`, `removed`, and `mod
272272``` ts
273273import { Component } from ' @angular/core' ;
274274import { AngularFirestore , AngularFirestoreCollection } from ' angularfire2/firestore' ;
275- import { Observable } from ' rxjs/Observable ' ;
275+ import { Observable } from ' rxjs' ;
276276
277277@Component ({
278278 selector: ' app-root' ,
0 commit comments