I'm attempting to implement the example of Angular Material Text Filtering by using the data obtained from an http get request.
export class MyDtoDataSource extends DataSource<IMyDto> {
private _filterChange = new BehaviorSubject('');
public get filter(): string { return this._filterChange.value; }
public set filter(filter: string) { this._filterChange.next(filter); }
constructor(private _apiService: ApiService) {
super()
}
connect(): Observable<IMyDto[]> {
const displayDataChanges = [
this._apiService.getMyDtos(),
this._filterChange,
];
return Observable
.merge(...displayDataChanges)
.map((dtos: IMyDto[]) => dtos.filter(dto => dto.categories.map(i => i.name).includes(this.filter)));
}
disconnect() {
}
}
However, it seems like there might be an issue with my mapping function since I am encountering the runtime error dtos.filter is not a function