关于IE10 及如下版本使用angularjs style={{expression}}不显示的兼容性问题

使用ng-style标记来替代style="{{ someCss }}"。对象

ng-style 属性值必须是对象,表达式返回的也是对象。class

写法1:scope

<div class='progress-bar' style="{'width':'{{percent}}%'}"></div>di

controller 中:co

$scope.percent = 40;controller

 

写法2:

<div class='progress-bar' style="barWidth"></div>

controller 中:

$scope.barWidth = {

  'width' : '40%'

};

相关文章
相关标签/搜索