* 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
()
| 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 { |
no test coverage detected