I'm currently working on an Angular 5 application and I need to be able to apply dynamic CSS within the style tag in the template. I've tried a few solutions but so far, none have worked.
app.component.ts
customCss : any;
constructor(){}
ngOnInit(){
this.customCss['color'] = "red";
}
app.component.html
<div>
<span class="custom_css">This is an Angular 5 application</span>
</div>
<style>
.custom_css{
color: {{customCss.color}};
}
</style>
When I inspect the custom_css class in the browser, the style shows
.custom_css{
color: {{customCss.color}};
}
Any assistance you can provide would be greatly appreciated.