JSFiddle - React, Tailwind, and code Playground
by Daniel Lamb
HTML
<div ng-app="myApp">
<form ng-controller="Example">
<input ng-model="value" ng-pattern="/^\d+$/" />
(only integers are valid)
</form>
</div>
CSS
input {
-webkit-transition: all linear 0.25s;
transition: all linear 0.25s;
background: transparent;
}
input.ng-invalid {
color: #fff;
background: #c00;
}
JavaScript
angular.module('myApp', [])
.controller('Example', ['$scope', function ($scope) {
$scope.value = 42;
}]);