我必须将Angular5代码升级到Angular6,但是静态combineLatest有一个问题。
export function test<T>(id: string | Observable<string>): OperatorFunction<T[], T> {
const id$ = asObservableIfNot(id);
return pipe(
combineLatest(id$, (collection: T[], resolvedId) => {
return collection.find(element => {
return element.id === resolvedId;
});
}),
distinctUntilChanged()
);
}在本例中,运算符是从rxjs/ combineLatest导入的,并返回一个OperatorFunction,但静态运算符返回一个Observable。
如何在angular6中转换此代码?
发布于 2018-09-18 21:11:42
从RxJs6开始,你必须使用带有map函数的管道。
someObservable.pipe(map(...))https://stackoverflow.com/questions/52383286
复制相似问题