JSFiddle - React, Tailwind, and code Playground
by Anik Islam Abhi
HTML
<div ng-app="app" ng-controller="myCtrl">
<div ng-repeat="item in items" ng-style="{ 'backgroundColor': getBoxBackgroundColor() }">{{item}}</div>
<button ng-click="addItem()">Add Item</button>
</div>
JavaScript
var app = angular.module("app", []);
app.controller("myCtrl", function($scope) {
$scope.items = [1, 2, 3, 4];
$scope.getBoxBackgroundColor = function() {
return '#FF0000';
}
$scope.addItem = function() {
$scope.items.push($scope.items.length + 1);
}
});