How to call dynamic styles in angular2
Here I tried to call the themeColor variable in the .activeLink class, but it doesn't work. Is there 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>
+3
source to share