JSFiddle - React, Tailwind, and code Playground

HTML

<form ng-app="miniapp" name="miniform" novalidate> 
    <div ng-controller="Ctrl">
        <input name="field" type="text" ng-model="value" number="" />
        <span ng-show="miniform.field.$error.number">Field must contains number</span>
    </div>
</form>

JavaScript

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

app.controller('Ctrl', function($scope) {
    $scope.value = '';
});

app.directive('number', function () {
	return {
		require: 'ngModel',
		link: function (scope, elm, attrs, ctrl) {			
			ctrl.$parsers.unshift(function (viewValue) {
                var isEmpty = viewValue === '';
                var isNumber = !isNaN(parseInt(viewValue));
				ctrl.$setValidity('number', isEmpty || isNumber);
				return viewValue;
			});
		}
	};
});