Here is a clickable div. Once it clicked, it's supposed to change its position (defined by an inline CSS rule). The callback function is successfully invoked.
Problem: model change does not affect the inline CSS. Although initial values works well.
View:
<div data-ng-repeat="item in items"
data-ng-click="item.clicked()"
data-ng-style="{'left': '{{item.left}}', 'width': '{{item.width}}', 'top': '0' }">
</div>
Controller:
var item = {
left: '30%',
width: '20%'
};
(function(item) { // because inside a loop
item.clicked = function() {
console.log("item clicked");
item.width = '100%';
item.left = '0%';
};
})(item);
$scope.items.push(item);
Angular 1.4