ng-style用法

我想给ng-style传一个controller里面的变量,折腾了半天,引号不能忘

ng-style="{'background-color':'{{markColor}}'}"

Since some CSS style names are not valid keys for an object, they must be quoted. See the ‘background-color’ style in the example below.

还有一个问题,string.repalce is not a function,这个貌似是因为要初始化.
myStyle = {};
ng-style=”myStyle”

你可能感兴趣的:(angularjs,css)