ng-style doesn't work when window resize
ng-style can bind but it don't effect to style after resize window. In first binding
<div ng-style="{'left':'703px', 'top':'-11px'}" style="left: 703px; top: -11px;"></div>
after resize :
<div ng-repeat="com in vm.comments" ng-style="{'left':'525px', 'top':'-11px'}" style="left: 703px; top: -11px;"></div>
Data in ng-style is changed but style isn't.
Can you provide the jsfiddle(http://jsfiddle.net/) URL for your bug to understand what u r changing on window resize.
You must use $scope.$apply() when making changes in non-angular event handlers.
See https://code.angularjs.org/1.3.0-beta.7/docs/guide/scope, section "Integration with the browser event loop"
e: I see, this time the problem isn't applying the changes, it's the syntax.
You can check it in: http://plnkr.co/edit/nCZKaveRLsahntPGjupY?p=preview Try resize window and compare data in ng-style vs style.
Your ng-style syntax is not correct. Try this:
ng-style="{'left': cam.left + 'px'}"
Yes, it's right :+1: Thank you!