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

Method _setColor

src/material/badge/badge.ts:354–360  ·  view source on GitHub ↗

Adds css theme class given the color to the component host

(colorPalette: ThemePalette)

Source from the content-addressed store, hash-verified

352
353 /** Adds css theme class given the color to the component host */
354 private _setColor(colorPalette: ThemePalette) {
355 const classList = this._elementRef.nativeElement.classList;
356 classList.remove(`mat-badge-${this._color}`);
357 if (colorPalette) {
358 classList.add(`mat-badge-${colorPalette}`);
359 }
360 }
361
362 /** Clears any existing badges that might be left over from server-side rendering. */
363 private _clearExistingBadges() {

Callers 1

colorMethod · 0.95

Calls 2

removeMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected