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

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

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

写法1:

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

controller 中:

$scope.percent = 40;

 

写法2:

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

controller 中:

$scope.barWidth = {

  'width' : '40%'

};

 

posted @ 2016-08-26 13:16  月下小狸123  阅读(1732)  评论(0编辑  收藏  举报