JSFiddle - React, Tailwind, and code Playground

by Son Che Dinh

HTML

<body ng-app="myapp">
  <form name="myForm" ng-controller="FormController" class="my-form">
    Thông báo: <input name="input" ng-model="userType" required><br/>
    <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br>
    <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br>
    <tt>myForm.$valid = {{myForm.$valid}}</tt>
  </form>
</body>

CSS

*{margin:0}body{padding:20px}
.my-form {
  -webkit-transition:all linear 0.5s;
  transition:all linear 0.5s;
  background: transparent;
}
.my-form.ng-invalid {
  background: red;
}

JavaScript

angular.module('myapp', []).controller('FormController', ['$scope', function($scope) {}]);