JSFiddle - React, Tailwind, and code Playground
by Son Che Dinh
HTML
<body ng-app="MyForm">
<form name="testForm" ng-controller="ExampleController">
<div>
Chỉ được nhập số
</div>
<input ng-model="val" ng-pattern="/^\d+$/" name="anim" class="my-input" />
</form>
</body>
CSS
.my-input {
-webkit-transition:all linear 0.5s;
transition:all linear 0.5s;
background: transparent;
}
.my-input.ng-invalid {
color:white;
background: red;
}
JavaScript
angular.module('MyForm', []).controller('ExampleController', ['$scope', function($scope) {}]);