使用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%'
};