gpt4 book ai didi

angular - RxJS 更新,属性 'merge' 在类型 'typeof Observable' 上不存在

转载 作者:行者123 更新时间:2023-12-01 12:09:45 29 4
gpt4 key购买 nike

我更新了我的 Material Angular 项目以在我的表格中包含一个可扩展的细节行。为此,我需要升级到 rsjx 6。现在我收到以下错误。我对 angular 完全陌生,所以不幸的是我不知道如何解决这个问题。

Property 'merge' does not exist on type 'typeof Observable'.

任何人都可以帮助解决此错误吗?

app.component.ts

  /** Connect function called by the table to retrieve one stream containing the data to render. */
connect(): Observable<Track[]> {
// Listen for any changes in the base data, sorting, filtering, or pagination
const displayDataChanges = [
this._exampleDatabase.dataChange,
this._sort.sortChange,
this._filterChange,
this._paginator.page
];

this._exampleDatabase.getAllTracks();

return Observable.merge(...displayDataChanges).map(() => {
// Filter data
this.filteredData = this._exampleDatabase.data.slice().filter((track: Track) => {
const searchStr = (track.id + track.title + track.artist + track.year + track.comment + track.path).toLowerCase();
return searchStr.indexOf(this.filter.toLowerCase()) !== -1;
});

// Sort filtered data
const sortedData = this.sortData(this.filteredData.slice());

// Grab the page's slice of the filtered sorted data.
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
this.renderedData = sortedData.splice(startIndex, this._paginator.pageSize);
return this.renderedData;
});
}

最佳答案

静态 merge从版本 6 开始导入如下:

import {merge} from 'rxjs'

然后将其用作:
merge(...)

关于angular - RxJS 更新,属性 'merge' 在类型 'typeof Observable' 上不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52803121/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com