Loiane Groner
import { Subject } from 'rxjs/Subject';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of;'
Antes
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/mergeMap';
import 'rxjs/add/operator/switchMap';
Depois
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/mergeMap';
import 'rxjs/add/operator/switchMap';
Antes
import { of } from 'rxjs';
import { map, switchMap, catchError, mergeMap } from 'rxjs/operators';
Depois
do -> tap
catch -> catchError
switch -> switchAll
finally -> finalize
Depois
this.http.get('url')
.do(console.log)
.map(results => results.data)
.subscribe(results => {
console.log('Resultados', results);
});
Antes
this.http.get('url')
.pipe(
tap(console.log), // antigo operador 'do'
map(results => results.data)
)
.subscribe(results => {
console.log('Resultados', results);
});
Depois