Issue
I am getting error for using this variable as a color in my html file
<span style=`color: ${_currentConfig.statusColor};`>{{ _currentConfig?.content }}</span>
Whats wrong here ? main.js:1 DOMException: Failed to execute 'setAttribute' on 'Element': '${_currentConfig.statusColor};
' is not a valid attribute name.`
Solution
you can use Angular's binding syntax to dynamically set the style. Here's an example :
<span [style.color]="_currentConfig?.statusColor">{{ _currentConfig?.content }}</span>
Answered By - dev.skas
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.