I updated my material angular project to include an expandable detail row in my table. I needed to upgrade to rsjx 6 for this. Now I get the following error. I'm totally new with angular, so unfortunately I don't have a clue how to resolve this.
Property 'merge' does not exist on type 'typeof Observable'.
Can anyone help to resolve this error?
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;
});
}
Static merge
is imported as the following since version 6:
import {merge} from 'rxjs'
Then use it as:
merge(...)
in old version of rxjs
you use Observable.merge(...array).map(() => {});
.
for new versions i.e rxjs 6+ you have to use following syntax:
import { merge } from 'rxjs';
import { map } from 'rxjs/operators';
merge(...array).pipe(
map(...),
...
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With