I hereby tried to call the themeColor variable in .activeLink class, but it's not working. Is it any way to get the value dynamically? please help.
styles:[`
.activeLink{
background:${this.themeColor} !important;
color: #fff !important;
}
`]
export class NavBarComponent implements OnInit{
themeColor = "#ff0"
}
HTML
<a [routerLink]="['/public']" routerLinkActive="activeLink"
[routerLinkActiveOptions]="{exact:true}"><i class="fa fa-home"></i> {{
'home.menu.home' | translate }}</a>
There is no interpolation support for styles in Angular
You can use
<some-element [style.background-color]="themeColor"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With