Chr*_*rós 37 templates expression internet-explorer-8 angularjs
在style属性上使用这样的表达式可以在Chrome上运行,但在IE8上不起作用
style="width:{{progress}}%"
Run Code Online (Sandbox Code Playgroud)
http://jsfiddle.net/5VDMD/12/ (测试请在文本框中输入一个数字)
针对此问题的任何解决方法?
小智 57
尝试
ng-style="{ width: progress + '%' }"
Run Code Online (Sandbox Code Playgroud)
Jas*_*son 26
我不得不使用ng-attr-style(虽然我不需要使用函数).
<div ng-attr-style="width: {{value}}%"></div>
Run Code Online (Sandbox Code Playgroud)
这是关于这个问题的github讨论.
小智 13
我这样做了:
在控制器中:
$scope.getStyle = function(progress){
return {
width: progress + "%"
}
}
Run Code Online (Sandbox Code Playgroud)
在HTML中:
<div class="progbar" ng-style="getStyle(progress)"></div>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17645 次 |
| 最近记录: |