<!doctype html>
<html>
<head>
<title>angularjs phone number validation</title>
<script src="http://code.angularjs.org/1.2.9/angular.min.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>Phone No. :</div>
<div>
<input type="text" placeholder="+91-636-78658" name="phone" ng-pattern="phoneNumbr" ng-model="phone" />
<span class="error" ng-show="myForm.phone.$error.required">Required!</span>
<span class="error" ng-show="myForm.phone.$error.minlength">Phone no not less that 10 char.</span>
<span class="error" ng-show="myForm.phone.$error.maxlength">Phone no not more than 11 char.</span>
<br><span class="error" ng-show="myForm.phone.$error.pattern">Please match pattern [+91-036-78658 || 91-036-78658]</span>
</div>
</ng-form>
<br/>
<div>
<a href="http://www.code-sample.com/" traget="_blank">Go for more detail...</a>
</div>
</body>
</html>
// Code goes here
/* Styles go here */