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

Method _subscribeToAllTabChanges

src/material/tabs/tab-group.ts:421–433  ·  view source on GitHub ↗

Listens to changes in all of the tabs.

()

Source from the content-addressed store, hash-verified

419
420 /** Listens to changes in all of the tabs. */
421 private _subscribeToAllTabChanges() {
422 // Since we use a query with `descendants: true` to pick up the tabs, we may end up catching
423 // some that are inside of nested tab groups. We filter them out manually by checking that
424 // the closest group to the tab is the current one.
425 this._allTabs.changes.pipe(startWith(this._allTabs)).subscribe((tabs: QueryList<MatTab>) => {
426 this._tabs.reset(
427 tabs.filter(tab => {
428 return tab._closestTabGroup === this || !tab._closestTabGroup;
429 }),
430 );
431 this._tabs.notifyOnChanges();
432 });
433 }
434
435 ngOnDestroy() {
436 this._tabs.destroy();

Callers 1

ngAfterContentInitMethod · 0.95

Calls 2

resetMethod · 0.65
filterMethod · 0.45

Tested by

no test coverage detected