ng-pattern Number Validation using Angular Example

Today, We want to share with you ng-pattern Number Validation using Angular Example.In this post we will show you Angularjs ng-pattern form validation example, hear for Angularjs ng-pattern validation example we will give you demo and example for implement.In this post, we will learn about angularjs ng-pattern only numbers with an example.

ng-pattern Number Validation using Angular Example

There are the Following The simple About Angularjs ng-pattern with regular expressions Full Information With Example and source code.

As I will cover this Post with live Working example to develop Angularjs ng-pattern to allow only numbers example, so the ng-pattern angular 6 is used for this example is following below.

AngularJS ng-pattern Number Validation Example

Angular is a platform for building mobile & desktop web Based user friendly and light weight applications.Angular,It’s TypeScript-based open-source Angularjs web application framework.


<!DOCTYPE html>
<title>AngularJs ng-pattern Form Validation Example AngularJS Tutorials, Demo with Example -</title>
<script src=""></script>
<script type="text/javascript">
var webApplication = angular.module('ngpatternRootApplication', []);
webApplication.controller('ngpatternController', function ($scope) {
$scope.sendForm = function () {
$scope.message = "Form Validated";
<div ng-app="ngpatternRootApplication" ng-controller="ngpatternController">
<h3>AngularJs ng-pattern with Number Validation Example</h3>
<form name="memberForm" novalidate ng-submit="memberForm.$valid &&sendForm()">
Pin Code:<input type="text" name="pincode" ng-model="txtpin" ng-pattern="/^[0-9]{1,5}$/" required />
<span style="color:#c60000" ng-show="memberForm.pincode.$error.required"> Required! </span>
<span style="color:#c60000" ng-show="memberForm.pincode.$dirty&&memberForm.pincode.$error.pattern">Only Numbers Allowed, Maximum 5 Characters</span>
<hr /><hr />
<button type="submit">Submit Form</button><hr /><hr />

Web Programming Tutorials Example with Demo

Read :


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about ng-pattern for decimal number.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Related FAQ

Here are some more FAQ related to this Article:

  1.   Ajax Upload Multiple Images without form submitting
  2.   Laravel create Dynamic Email Templates from Database
  3.   Laravel 5.7 Queues Send Mail Tutorial With Example
  4.   How to Get Absolute Directory Path in PHP Script
  5.   jQuery Removing All Spaces From String
  6.   Vue js Axios HTTP Put Method Example Tutorial From Scratch
  7.   Laravel 6 Install Constant Contact - PHP Examples
  8.   How to validate URL Pattern in Angular?
  9.   Laravel 6 schema Timestamps Example
  10.   jQuery Convert string to integer Example