如何设置背景颜色而不是颜色?

时间:2017-11-09 06:53:11

标签: angularjs

<tr dir-paginate="test in data" ng-style="calculateStyle(test)">
<td>{{test.FirstName}}</td>
<td>{{test.LastName}}</td>
<td>{{test.Status}}</td>
</tr>

$scope.calculateStyle = function(test) {
    var style = {}
    if (test.Status == 'Cleared')
        style.color = 'green';
    return style;
}

如何设置背景颜色而不是颜色。我使用了backgroundColor,但它没有用。

2 个答案:

答案 0 :(得分:1)

使用style['background-color']= 'green'

Demo

Src

答案 1 :(得分:0)

尝试使用style['background']:'green'style.background:'green'