JSFiddle - React, Tailwind, and code Playground
by vla
HTML
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js"></script>
<ul ng-controller="ColorCtrl">
<li ng-class="{favorite: isFavorite(color)}" ng-style="{ 'background-color': color }"
ng-click="deleteColor($index)" ng-repeat="color in colors">The color you see here is named {{color}}. <span ng-show="isFavorite(color)">This one's my favorite!</span>
</li>
</ul>
CSS
.favorite {
font-style: italic;
}
JavaScript
var myApp = angular.module('myApp',[]);
function ColorCtrl($scope) {
$scope.colors = ['green', 'orange', '#345b', '#abcdef'];
$scope.isFavorite = function (color) {
return color === 'green';
};
$scope.deleteColor = function (index) {
$scope.colors.splice(index, 1);
};
}