Ng-Style-4

 

Ng-repeat display the circles of different colors using boxClass and colors take from array of object colorBg.The color of circles continuously changes due to updateArray function that is call by $interval.

 
 
 
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Welcome to LearnKode - A code learning platform</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> <style type="text/css"> .boxClass { width: 50px; height: 50px; } </style> </head> <body ng-app="app"> <div ng-controller="controllerName"> <table> <tr> <td ng-repeat="obj in colorBg" class="boxClass" style="border-radius: 30px; background: {{obj.color}}"></td> </tr> </table> </div> <script> var app = angular.module("app", []); app.controller('controllerName', ['$scope', '$interval', function ($scope, $interval) { $scope.colorBg = [{ color: "tomato" }, { color: "maroon" }, { color: "blue" }, { color: "red" }, { color: "yellow" }, { color: "green" }]; $scope.colorBg1 = [{ color: "tomato" }, { color: "maroon" }, { color: "blue" }, { color: "red" }, { color: "yellow" }, { color: "green" }]; $scope.updateArray = function () { var Arr = $scope.colorBg.splice(0, 1); $scope.colorBg.push(Arr[0]); }; $scope.updateArray1 = function () { for (var i = $scope.colorBg1.length-1; i >0 ; i--) { var Arr = $scope.colorBg1.splice(0,1); $scope.colorBg1.push(Arr[0]) } }; $interval($scope.updateArray, 300); }]); </script> </body> </html>
Output