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

Method constructor

src/material/icon/icon.ts:242–261  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

240 private _currentIconFetch = Subscription.EMPTY;
241
242 constructor() {
243 const ariaHidden = inject(new HostAttributeToken('aria-hidden'), {optional: true});
244 const defaults = inject<MatIconDefaultOptions>(MAT_ICON_DEFAULT_OPTIONS, {optional: true});
245
246 if (defaults) {
247 if (defaults.color) {
248 this.color = this._defaultColor = defaults.color;
249 }
250
251 if (defaults.fontSet) {
252 this.fontSet = defaults.fontSet;
253 }
254 }
255
256 // If the user has not explicitly set aria-hidden, mark the icon as hidden, as this is
257 // the right thing to do for the majority of icon use-cases.
258 if (!ariaHidden) {
259 this._elementRef.nativeElement.setAttribute('aria-hidden', 'true');
260 }
261 }
262
263 /**
264 * Splits an svgIcon binding value into its icon set and icon name components.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected