简体   繁体   English

ng样式没有动态更新

[英]ng-style did not update dynamically

I tried to use ng-style because I need some dynamic color to work on IE11. 我尝试使用ng-style因为我需要一些动态颜色才能在IE11上工作。

<tr ng-style="{'background-color':'{{section.Color}}'}">

I have a Angularjs module that allow me to change color dynamically: 我有一个Angularjs模块,可让我动态更改颜色:

<button type="button" colorpicker type="button" colorpicker-position="top" ng-model="section.Color" >
      change color
    </button>

Some how it doesn't work. 一些不起作用的方法。 But if it is in normal style, it will update the color. 但是,如果它是普通样式,它将更新颜色。 How can I resolve this? 我该如何解决?

Try this one 试试这个

<tr ng-style="{'background-color':section.Color}">

no need to {{}} for section.Color in ng-style 无需{{}}section.Color ng-styleng-style

这条路

<tr ng-style="{'background-color':{{section.Color}} }">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM