Search code examples
javascriptcssangularng-style

ngStyle with a function call not working in IE


in an angular 4 application i have styles like below

[ngStyle]="{'border': getInterleaveColor(i)}"

and the function

 getInterleaveColor(auditNumber) {
    var borderProperties = '2px solid';
    if (auditNumber % 2 == 0)
        return borderProperties + '#0078D2';
    else
        return borderProperties + '#00B989';
}

is working fine in chrome but not working in IE.


Solution

  • You need to add a space after solid so solid and the hex color are not a single string

    var borderProperties = '2px solid ';