I wanted to create a dynamic background-color
for my .active
class of my mat-list-item
HTML:
<mat-list-item
*ngFor="let page of pages"
matRipple
routerLinkActive="active"
>
<a [routerLink]="page.path" (click)="drawer.close()"
><mat-icon class="mat-18">{{ page.iconName }}</mat-icon
>{{ page.name }}</a
>
</mat-list-item>
So now basically assigning .active {background: red}
works as expected. What I wanted to do is apply the built in theme
$primary
color value. I'm using Angular Material indigo-pink
theme so I've tried doing the following
@import "~@angular/material/prebuilt-themes/indigo-pink.css";
.active {
background-color: $primary;
}
This throws error
ERROR in Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Undefined variable.
╷
│ background-color: $primary;
│ ^^^^^^^^
╵
Anything that I missed?