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

Method ngAfterViewInit

src/material/badge/badge.ts:221–239  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

219 }
220
221 ngAfterViewInit() {
222 if (typeof ngDevMode === 'undefined' || ngDevMode) {
223 const nativeElement = this._elementRef.nativeElement;
224
225 // Heads-up for developers to avoid putting matBadge on <mat-icon>
226 // as it is aria-hidden by default docs mention this at:
227 // https://material.angular.dev/components/badge/overview#accessibility
228 if (
229 nativeElement.tagName.toLowerCase() === 'mat-icon' &&
230 nativeElement.getAttribute('aria-hidden') === 'true'
231 ) {
232 console.warn(
233 `Detected a matBadge on an "aria-hidden" "<mat-icon>". ` +
234 `Consider setting aria-hidden="false" in order to surface the information assistive technology.` +
235 `\n${nativeElement.outerHTML}`,
236 );
237 }
238 }
239 }
240
241 ngOnDestroy() {
242 // ViewEngine only: when creating a badge through the Renderer, Angular remembers its index.

Callers

nothing calls this directly

Calls 2

warnMethod · 0.80
getAttributeMethod · 0.65

Tested by

no test coverage detected