angularjs - dynamic css style not working on ie? -
i have simple problem of dynamic css setting not working on ie properly:
i have code:
<div class="i-storage-bar-chart-bar-container"> <div class="i-storage-bar-chart-bar" style="height: {{(storage.totalstorage * 100) / model.maxstoragecapacity}}%"> <div class="i-storage-bar-chart-bar-inner" style="height: {{(storage.usedstorage * 100) / storage.totalstorage}}%"></div> </div>
this kind of code simple chart height of told inside curly braces, working ok in chrome , firefox, in ie doesn't anything, way working doing following: (non dynamic)
<div class="i-storage-bar-chart-bar-container"> <div class="i-storage-bar-chart-bar" style="height: 20%"> <div class="i-storage-bar-chart-bar-inner" style="height:10%"></div> </div>
what can fix problem ie , still maintaining dynamic stuff happening?
you should use ng-style
on controller:
$scope.style = { 'height': (storage.totalstorage * 100 / model.maxstoragecapacity) + '%' }
and on div:
<div ng-style="style"></div>
Comments
Post a Comment