JSFiddle - React, Tailwind, and code Playground
by Norlihazmey Ghazali
HTML
<div ng-app="MyApp" ng-controller="validateCtrl">
<form name="myForm" novalidate>
<input
type="text"
name="a"
ng-model="a" ng-pattern="/[a-zA-Z0-9]/" />
<span style="color:red" ng-show="myForm.a.$dirty && myForm.a.$invalid">
<span ng-show="myForm.a.$error.pattern">Username is required.</span>
</span>
</form>
</div>
`
JavaScript
var app = angular.module('MyApp', []);
app.controller('validateCtrl', function($scope) {
$scope.a = 'John Doe';
console.log($scope.a)
$scope.email = '[email protected]';
});