Reputation: 1999
I'm using Visual Studio Code (1.12.2) for a HTML based project that uses Angular. vscode marks the following line as syntactically incorrect, even though from an Angular point of view it is absolutely valid (correct me if I'm wrong):
<div class="meeting-header" style="background: {{ meeting.color }}">
I know that {
and }
are no valid characters in this context. Still, that makes me wonder whether there is a better way to bind some property in Angular to a CSS property.
Is there another way in Angular to bind a property in the scope to a CSS property?
Upvotes: 0
Views: 38
Reputation: 121
Why not use ng-class and have all those neat styling be separated on your .css file?
ref:
Upvotes: 0
Reputation: 532
Yes, use ng-style
instead, like this:
<div class="meeting-header" ng-style="{background: meeting.color}">
Read more about it in the documentation
Upvotes: 2