關於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%'

};

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM