I dont get rxjs 6 with angular 6 with interval, switchMap, and map

Tampa

I want to update my rxjs code to 6 got I don't get it.

Before I had the below that wouth poll for new data every 5 seconds:

import { Observable, interval } from 'rxjs';
import { switchMap, map } from 'rxjs/operators';

var result = interval(5000).switchMap(() => this._authHttp.get(url)).map(res => res.json().results);

Now...of course, it's broken and the documentation leaves me nowhere to go.

How do I write the above to conform to rxjs 6?

Thanks

siva636

The code should be something like the following. You need to use the pipe operator.

import { interval } from 'rxjs';
import { switchMap, map } from 'rxjs/operators';

const result = interval(5000).pipe(
switchMap(() => this._authHttp.get(url)),    
map(res => res.results)
)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Angular6: RxJS switchMap operator is not working as expected

How do I return the Resolved Data with the new RXJS 6 pipe/map in Angular 6?

incorrect imports in angular 6/rxjs of/map etc

Angular Map and mergeMap rxjs6 operators

RxJS 6 switchMap Deprecated Symbol used

Angular 6: how to get http at an interval

How can I process results from http.get() in Angular 6/RxJS 6?

map vs switchMap in RxJS

Angular 6 - rxjs property 'map' does not exist on type 'observable'

Missing `switchMap` and `flatMap` overloads containing 'resultSelector' in RxJS6

rxjs6 error handling when using switchMap

How to chain switchMap-operators with function bodies in rxjs 6

RxJs switchMap with angular HttpClient

angular and RxJS/switchMap

return for SwitchMap in Rxjs - Angular

RxJS & Angular 6 - observables, subjects and basic get and add operations on arrays

rxjs 6 pipe is not working in Angular 6

rxjs 6 countdown timer subscribe angular 6

Angular 6 & RxJS 6 Breaking Changes

Angular 6 RXJS Import Syntax?

Convert Rxjs code to Angular 6 and latest rxjs

Using Angular, RxJs 6 and InMemoryAPI how do I get a returned Observable value that seems to be nested in multiple observable sources?

Get map value with RXJS and angular

Angular typeahead with RxJs switchMap subscribe

Angular: RxJs switchMap producing error

rxjs switchMap not working in Angular Guard?

RxJS 6 filter and map an observable array of items

Angular 6: How to unsubscribe rsjx interval or timer?

call and wait in interval using subscribe in Angular 6