JSFiddle - React, Tailwind, and code Playground

HTML

<div ng-app="MyApp" ng-controller="MyController">
    <label for="firstname">First Name</label>
    <input type="text" ng-model="firstName" ng-class="{neccessary : errorFirstName}" id="firstname" required />
    <button ng-click="checkUsr()">Check user</button>
</div>

CSS

.neccessary{
    background-color: red;
}

JavaScript

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

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

    $scope.checkUsr = function () {
        $scope.errorFirstName = false;
    }
});

app.directive('myDirective', function () {
    return {
        restrict: 'E',
        scope: {
            data: "="
        },
        templateUrl: 'home/user.html'
    }
});