2017-11-09 18 views
0
<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を使用しましたが、動作しません。色の代わりに背景色を設定するには?

+0

を使用してみてください? – Durga

+1

'backgroundColor'は動作します(http://jsfiddle.net/durga598/ADukg/15826/)、あなたの状態を確認してください、動作していない可能性があります – Durga

+0

imはng repeat - table – konda

答えて

1

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

Demo

Src

+0

私は使用しました。働いていない。 – konda

+0

これを見てください:https://plnkr.co/edit/364i3Wm4Gu3aGIFVKAl3?p=previewあなたのコードにおそらく問題があります。 '' background-color''と 'backgroundColor'は両方とも動作しています。 –

0

あなたはUIでこの `calculateStyle`を使用している方法style['background']:'green'またはstyle.background:'green'

関連する問題