Set up a subscription for the data provided by the data source.
()
| 1244 | |
| 1245 | /** Set up a subscription for the data provided by the data source. */ |
| 1246 | private _observeRenderChanges() { |
| 1247 | // If no data source has been set, there is nothing to observe for changes. |
| 1248 | if (!this.dataSource) { |
| 1249 | return; |
| 1250 | } |
| 1251 | |
| 1252 | let dataStream: Observable<readonly T[]> | undefined; |
| 1253 | |
| 1254 | if (isDataSource(this.dataSource)) { |
| 1255 | dataStream = this.dataSource.connect(this); |
| 1256 | } else if (isObservable(this.dataSource)) { |
| 1257 | dataStream = this.dataSource; |
| 1258 | } else if (Array.isArray(this.dataSource)) { |
| 1259 | dataStream = observableOf(this.dataSource); |
| 1260 | } |
| 1261 | |
| 1262 | if (dataStream === undefined && (typeof ngDevMode === 'undefined' || ngDevMode)) { |
| 1263 | throw getTableUnknownDataSourceError(); |
| 1264 | } |
| 1265 | |
| 1266 | this._renderChangeSubscription = combineLatest([dataStream!, this.viewChange]) |
| 1267 | .pipe(takeUntil(this._onDestroy)) |
| 1268 | .subscribe(([data, range]) => { |
| 1269 | this._data = data || []; |
| 1270 | this._renderedRange = range; |
| 1271 | this._dataStream.next(data); |
| 1272 | this.renderRows(); |
| 1273 | }); |
| 1274 | } |
| 1275 | |
| 1276 | /** |
| 1277 | * Clears any existing content in the header row outlet and creates a new embedded view |
no test coverage detected