AngularJS Example

by fizerkhan

HTML

<div ng-app="myApp" ng-controller="MyController">
 
<div ng-repeat="item in items">
  <div class="circle" ng-style="getStyle(item.value)">
       <div class="circle-text">{{item.value}}</div>
  </div>
</div>
</div>

JavaScript

var myApp = angular.module('MyApp',[])
myApp.controller('MyController', function($scope) {
    $scope.items = [
        { 
            value: 10,
        },
        {
            value: 20,
        }
        ];
    
    $scope.getStyle = function(value) {
        return 'left: ' + value + ';';    
    }
    
    
});