@ -1,10 +1,9 @@
|
||||
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import 'rxjs/add/observable/of';
|
||||
import { of } from 'rxjs';
|
||||
|
||||
// #docregion
|
||||
|
||||
import { ajax } from 'rxjs/observable/dom/ajax';
|
||||
import { ajax } from 'rxjs/ajax';
|
||||
import { map, catchError } from 'rxjs/operators';
|
||||
// Return "response" from the API. If an error happens,
|
||||
// return an empty array.
|
||||
@ -15,7 +14,7 @@ const apiData = ajax('/api/data').pipe(
|
||||
}
|
||||
return res.response;
|
||||
}),
|
||||
catchError(err => Observable.of([]))
|
||||
catchError(err => of([]))
|
||||
);
|
||||
|
||||
apiData.subscribe({
|
||||
|
Reference in New Issue
Block a user