Reputation:
I'm using ng-style to change the color of HTML element dynamically.
<i class="fa fa-circle" ng-style='{color: "{{getColor()}}"}'></i>
where getColor() function returns the color to be changed and it can return different colors based upon usecase. For the first time everything is working fine but when getColor() returns different color later, it does not update the color of HTML element.
Upvotes: 4
Views: 1852
Reputation: 286
Just try this:
<i class="fa fa-circle" ng-style="{color: getColor()}"></i>
Upvotes: 0
Reputation: 4568
Try this:
<i class="fa fa-circle" ng-style="{color: getColor()}"></i>
Upvotes: 2