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

Method _subscribeToTabLabels

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

* Subscribes to changes in the tab labels. This is needed, because the @Input for the label is * on the MatTab component, whereas the data binding is inside the MatTabGroup. In order for the * binding to be updated, we need to subscribe to changes in it and trigger change detection * manual

()

Source from the content-addressed store, hash-verified

492 * manually.
493 */
494 private _subscribeToTabLabels() {
495 if (this._tabLabelSubscription) {
496 this._tabLabelSubscription.unsubscribe();
497 }
498
499 this._tabLabelSubscription = merge(...this._tabs.map(tab => tab._stateChanges)).subscribe(() =>
500 this._changeDetectorRef.markForCheck(),
501 );
502 }
503
504 /** Clamps the given index to the bounds of 0 and the tabs length. */
505 private _clampTabIndex(index: number | null): number {

Callers 1

ngAfterContentInitMethod · 0.95

Calls 1

markForCheckMethod · 0.80

Tested by

no test coverage detected