I have angular 1.0.6 (I know it's old) and I have style attribute with expressions:
<li style="background-color: {{item.color}}">
<span style="color: {{item.color | contrastColor}}">{{item.label}}</span>
</li>
It work fine but not for IE (The app need to work for >IE10). When I open Developer tool the style attribute is not present. I've try to create custom style directive (because I tought that IE remove invalid attribute before Angular can read it) but with this simple code, I've got an error TypeError: Cannot read property 'replace' of undefined from jquery (tested on google chrome) because in my case item.color can be null
.directive("logStyle", function() {
// logStyle directive
return {
restrict: 'A',
link: function(scope, element, attrs) {
element.css(scope.$eval(attrs.logStyle));
}
};
});
How can I make it work. I know that there is ngStyle but it's not quite what I need.
{color: item.color}as attribute value.