---
title: "How to Validate a Phone Number in AngularJS"  
description: "How to Validate a Phone Number in AngularJS"  
author: "Anonymous User"  
published: 2016-02-28  
updated: 2016-02-28  
canonical: https://www.mindstick.com/forum/34014/how-to-validate-a-phone-number-in-angularjs  
category: "angular js"  
tags: ["angular js"]  
reading_time: 1 minute  

---

# How to Validate a Phone Number in AngularJS

we want to [Validate](https://www.mindstick.com/forum/1490/what-is-better-solution-for-validate-form-textboxs-value) a [Phone](https://www.mindstick.com/articles/23411/the-most-effective-method-to-find-the-perfect-small-business-phone-system-for-your-business) Number in AngularJS. please help me.

## Replies

### Reply by Anonymous User

```
@{    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <title>Forum</title>
    <meta name="viewport" content="width=device-width" />
    <script src="~/Scripts/jquery-1.9.1.js"></script>
    <script src="~/Scripts/angular.js"></script>
    <style>
        .error {
            color: red;
        }
    </style>
    <script>
        var app = angular.module('myApp', []);

        app.controller('mainCtrl', function ($scope) {
            $scope.phoneNumbr = /^\+?\d{2}[- ]?\d{3}[- ]?\d{5}$/;
        });
    </script>
</head>
<body ng-app="myApp">
    <ng-form name="myForm" ng-controller="mainCtrl">
        <div><b>Enter your Phone No:</b></div>
        <div>
            <input type="text" placeholder="+91-xxx-xxxxx" name="phone" ng-pattern="phoneNumbr" ng-model="phone" />
            <br><span class="error" ng-show="myForm.phone.$error.pattern">Please Enter vailid </span>
        </div>
    </ng-form>
</body>
</html>
```

```

```


---

Original Source: https://www.mindstick.com/forum/34014/how-to-validate-a-phone-number-in-angularjs

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
