Reputation: 3739
I am trying to implement a sort DataTable in an angular application, and the example I am implementing runs with the following error:
ERROR TypeError: Cannot read property 'apply' of undefined
at TableDataSource.webpackJsonp.332.TableDataSource.connect (data-table.component.ts:83)
The method that causes the error is the Observable.merge():
connect(): Observable<UserData[]> {
const displayDataChanges = [
this._exampleDatabase.dataChange, //BehaviorSubbject
this._sort.sortChange, //EventEmitter
];
return Observable.merge(...displayDataChanges).map(() => {
return this.getSortedData();
});
}
Do you have any idea about the cause of this error? I googled for an explanation of the message that I am getting but with no success
Upvotes: 1
Views: 2807
Reputation: 3739
I just found the cause of the problem: I had to import the merge!
import 'rxjs/add/observable/merge';
I paid attention to this by reading the answer to https://stackoverflow.com/questions/36585491/typescript-rxjs-observable-array-concat .
Upvotes: 5