JSFiddle - React, Tailwind, and code Playground

by Shashank Srivastava

HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.13/angular.min.js"></script>
<div ng-app="myApp">
    <div ng-controller="taskCtrl">
        <div class="underline" ng-class="{red: field.type.hasOwnProperty('red'), green: field.type.hasOwnProperty('green'), other: !field.type.hasOwnProperty('red') && !field.type.hasOwnProperty('green') }" ng-repeat="field in a">{{field}}</div>
    </div>
</div>

CSS

.red {
    color: red
}
.green {
    color: green
}
.other {
    color: blue
}
.underline {
    text-decoration: underline
}

JavaScript

var app = angular.module('myApp', []);

app.controller('taskCtrl', function ($scope) {

    $scope.a = [{
        type: {
            red: {}
        }
    }, {
        type: {
            orange: {}
        }
    }, {
        type: {
            green: {}
        }
    }, {
        type: {
            black: {}
        }
    }];
});