I am new to Angular2 and I'm looking for a way to dynamically change the CSS of an icon based on specific values.
Here is the code in HTML:
<li><i class="fa fa-check" [style.color]="'switch(types)'"></i>{{ types }}</li>
values assigned to 'types' range from 1 to 3.
In TypeScript:
switch(p) {
if(p == 0) {...} //set color to red
if(p == 1) {...} //set color to blue
if(p == 2) {...} //set color to green
}
However, this method doesn't seem to be effective for me.