<!DOCTYPE html>
<html>
<head>
<style>
input[type=number] {
height: 25px;
border: 1px solid #234fc4;
}
.button{
height: 30px;width: 100px;
border: 1px solid #234fc4;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
<script>
var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {
$scope.IsValid = function() {
alert("Price Is valid and form is submitted.");
}
});
</script>
</head>
<body ng-app="myApp">
<div ng-controller="formCtrl">
<h2>Use ng-pattern to validate in AngularJs</h2>
<form name="valForm" ng-submit="IsValid()">
<input type="number" ng-model="val" name="val" ng-pattern="/^\d{0,9}(\.\d{1,9})?$/" required>
<input class="button" type="submit" value="submit" />
</form>
</div>
</body>
</html>
// Code goes here
/* Styles go here */