I have an angular app and need to apply some CSS styles on a page, at runtime.
Solution using ng-style is not scalable:
I am aware that for specific (known) items, this can easily be done using the ng-style directive e.g.:
<div id="mydiv" ng-style="{color: bgColor}">ABCD</div>
However, this technique cannot be applied to all the <a>
or <p>
tags on the page. How does one apply a dynamic style based on an angular scope variable to ALL instances of a tag on the page?
Something like the following would be ideal:
<style> .in3_counter {color: {{settings.in3Color}};} .in4_counter {color: {{settings.in4Color}};} </style>
Update: The value of the css scope variables isn't predetermined, so I we don't know what colors would be applied to the elements as the variables are set at runtime (e.g. with color picker).
Any suggestions?