@angular/cdk/collections#isDataSource TypeScript Examples
The following examples show how to use
@angular/cdk/collections#isDataSource.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: table.ts From halstack-angular with Apache License 2.0 | 6 votes |
ngOnDestroy() {
this._headerOutlet.viewContainer.clear();
this._rowOutlet.viewContainer.clear();
this._cachedRenderRowsMap.clear();
this._onDestroy.next();
this._onDestroy.complete();
if (isDataSource(this.dataSource)) {
this.dataSource.disconnect(this);
}
}
Example #2
Source File: table.ts From halstack-angular with Apache License 2.0 | 6 votes |
/** Set up a subscription for the data provided by the data source. */
private _observeRenderChanges() {
// If no data source has been set, there is nothing to observe for changes.
if (!this.dataSource) {
return;
}
let dataStream: Observable<T[] | ReadonlyArray<T>> | undefined;
if (isDataSource(this.dataSource)) {
dataStream = this.dataSource.connect(this);
} else if (isObservable(this.dataSource)) {
dataStream = this.dataSource;
} else if (Array.isArray(this.dataSource)) {
dataStream = observableOf(this.dataSource);
}
if (dataStream === undefined) {
throw getTableUnknownDataSourceError();
}
this._renderChangeSubscription = dataStream
.pipe(takeUntil(this._onDestroy))
.subscribe((data) => {
this._data = data || [];
this.renderHeaders();
this.renderRows();
});
}