MCPcopy Create free account
hub / github.com/angular/components / _changeDataSource

Method _changeDataSource

src/cdk/scrolling/virtual-for-of.ts:307–317  ·  view source on GitHub ↗

Swap out one `DataSource` for another.

(
    oldDs: DataSource<T> | null,
    newDs: DataSource<T> | null,
  )

Source from the content-addressed store, hash-verified

305
306 /** Swap out one `DataSource` for another. */
307 private _changeDataSource(
308 oldDs: DataSource<T> | null,
309 newDs: DataSource<T> | null,
310 ): Observable<readonly T[]> {
311 if (oldDs) {
312 oldDs.disconnect(this);
313 }
314
315 this._needsUpdate = true;
316 return newDs ? newDs.connect(this) : observableOf();
317 }
318
319 /** Update the `CdkVirtualForOfContext` for all views. */
320 private _updateContext() {

Callers 1

CdkVirtualForOfClass · 0.95

Calls 2

disconnectMethod · 0.45
connectMethod · 0.45

Tested by

no test coverage detected