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

Function _onContentChanges

src/material/tabs/paginated-tab-header.ts:362–379  ·  view source on GitHub ↗

* Callback for when the MutationObserver detects that the content has changed.

()

Source from the content-addressed store, hash-verified

360 * Callback for when the MutationObserver detects that the content has changed.
361 */
362 _onContentChanges() {
363 const textContent = this._elementRef.nativeElement.textContent;
364
365 // We need to diff the text content of the header, because the MutationObserver callback
366 // will fire even if the text content didn't change which is inefficient and is prone
367 // to infinite loops if a poorly constructed expression is passed in (see #14249).
368 if (textContent !== this._currentTextContent) {
369 this._currentTextContent = textContent || '';
370
371 // The content observer runs outside the `NgZone` by default, which
372 // means that we need to bring the callback back in ourselves.
373 this._ngZone.run(() => {
374 this.updatePagination();
375 this._alignInkBarToSelectedTab();
376 this._changeDetectorRef.markForCheck();
377 });
378 }
379 }
380
381 /**
382 * Updates the view whether pagination should be enabled or not.

Callers

nothing calls this directly

Calls 3

markForCheckMethod · 0.80
updatePaginationMethod · 0.65

Tested by

no test coverage detected