I try to apply a css value (itemPosition) for each iteration of my ng-repeat. I call a function that returns me a value (0 to 100). I applied to the css property left.
For example, I have the following values: 53.345, 64.982 or 84.234
All left css properties are set to: 84.234.
While I would have:
iteration 1,
left: 53345; iteration 2,left: 64982; iteration 3,left: 84234;
My view :
<div ng-repeat="item in items" ng-init="setItemPosition(item.x)" >
<div class="circle" style="position: relative; left: {{itemPosition}}%;" >
<div class="circle-text">{{item.value}}</div>
</div>
</div>
In my controller, i have this function (The function returns a percentage) :
$scope.setItemPosition = function(value) {
var diffDate = ($scope.intervalResearchTime.endDateTime - $scope.intervalResearchTime.startDateTime) / 100;
var valueToPercent = ((value - $scope.intervalResearchTime.startDateTime) / diffDate);
$scope.itemPosition = valueToPercent; //exemple = 84.234;
};
It's possible to do something ?
ng-styleinstead ofstyleto execute Angular Expressions within your in-line style.