javascript - CSS not dynamically updating in AngularJS -


i'm trying make 2 div's width set angularjs value (0 - 100) did this:

<span class="green" ng-style="{width: '{{videorating}}%'}"</span> <span class="red" ng-style="{width: '{{100-videorating}}%'}"></span> 

but width calculated on initial value of videorating. when change value, won't update style.

any suggestions on how this?

i tried adding ng-cloak , $scope.$apply() no luck

ng-style should not use {{}} interpolation directive, use direct scope variables there.

markup

<span class="green" ng-style="{width: videorating + '%'}"</span> <span class="red" ng-style="{width: (100 - videorating) + '%'}"></span> 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -