我没有获得带有间隔,switchMap和map的角度为6的rxjs 6

我没有获得带有间隔,switchMap和map的角度为6的rxjs 6

问题描述:

如果我不明白,我想将我的rxjs代码更新为6.

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

在我进行下面的每5秒一次的新数据轮询之前:

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.

我如何编写以上内容以符合rxjs 6?

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

谢谢

代码应类似于以下内容.您需要使用pipe运算符.

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)
)