Ng-Style-5

 

Ng-repeat display the squares of different colors using boxClass and colors take from array of object colorBg.

 
 
 
<!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="background: {{obj.color}}"></td> </tr> </table> </div> <script> var app = angular.module("app", []); app.controller('controllerName', ['$scope', '$interval', function ($scope, $interval) { $scope.colorBg = [{ color: "maroon" }, { color: "magenta" }, { color: "tomato" }, { color: "red" }, { color: "green" }, { color: "yellow" }]; }]); </script> </body> </html>
Output