ngacw-dpi
Version:
Validates input as Guatemalan DPI (Documento Personal de Identificación, something like a SSN)
47 lines (44 loc) • 2.67 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
<link rel="stylesheet" href="../node_modules/bootstrap3/dist/css/bootstrap.css" />
<link rel="stylesheet" href="../node_modules/bootstrap3/dist/css/bootstrap-theme.css" />
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body ng-app="tests">
<div class="container" ng-controller="DpiTestController as vm">
<h1>Form Validation with DPI sample</h1>
<h2>{{vm.title}}</h2>
<form name="form" class="form" novalidate>
<div class="form-group" ng-class="{ 'has-error': form.dpi.$invalid && !form.dpi.$pristine }">
<label for="dpi">DPI:</label>
<input type="text" dpi class="form-control" id="dpi" name="dpi" placeholder="DPI" ng-model="dpi" required />
<span class="help-block" ng-show="form.dpi.$invalid && !form.dpi.$pristine && !form.dpi.$error.required">Invalid DPI</span>
<span class="help-block" ng-show="form.dpi.$error.required">Must enter a DPI</span>
<span class="help-block" ng-show="!form.dpi.$invalid">DPI ok!</span>
</div>
<button type="submit" ng-disabled="!form.$valid" class="btn btn-primary">Submit</button>
</form>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<!--script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script-->
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="../node_modules/bootstrap3/dist/js/bootstrap.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="../node_modules/angular/angular.js"></script>
<script src="../node_modules/ngacw-directives/src/ngacw-directives.module.js"></script>
<script src="../dist/ngacw-dpi.min.js"></script>
<script src="./module.js"></script>
<script src="./controller.js"></script>
</body>
</html>