-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
63 lines (52 loc) · 2.77 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!doctype html>
<html lang="en" ng-app="app">
<head>
<meta charset="UTF-8">
<title>Angular Form Errors Directive</title>
<script>document.write('<base href="' + document.location + '">');</script>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="demo.css">
</head>
<body ng-controller="MainCtrl">
<div class="container">
<div class="col-md-4 col-md-offset-4 col-sm-8 col-sm-offset-2">
<form ng-class="{ 'show-errors': showErrors }" name="loginForm" ng-submit="submit()" role="form" novalidate>
<div class="form-group">
<label for="inputUsername" class="control-label">Username (min 5 char)</label>
<input type="text" name="username" class="form-control" id="inputUsername" ng-minlength="5" required ng-model="user.username">
</div>
<div class="form-group">
<label for="inputPassword" class="control-label">Password (min 8 char)</label>
<input type="password" name="password" class="form-control" id="inputPassword" ng-minlength="8" required ng-model="user.password">
</div>
<div ng-form nice-name="Embedded ngForm" name="moreInfoForm" role="form" novalidate>
<h4>This is an embedded <code>ng-form</code></h4>
<div class="form-group">
<label for="inputUsername" class="control-label">First Name</label>
<input nice-name="1st Name" type="text" name="firstName" class="form-control" id="inputFirstName" required ng-model="user.firstName">
</div>
<div class="form-group">
<label for="inputPassword" class="control-label">Last Name</label>
<input type="text" error-messages="errorMessages" name="lastName" class="form-control" id="inputLastName" required ng-model="user.lastName">
</div>
<p ng-show="showErrors && !showChildren">ngForm Errors:</p>
<form-errors errors-tmpl="errors-tmpl.html" ng-hide="showChildren" class="list-unstyled"></form-errors>
</div>
<p ng-show="showErrors">Form Errors:</p>
<form-errors show-child-errors="showChildren" error-messages="errorMessages" class="list-unstyled"></form-errors>
<div class="form-group">
<button type="submit" class="btn btn-primary">Sign in</button>
</div>
<p ng-cloak ng-show="message">{{ message }}</p>
</form>
<label>
<input type="checkbox" ng-model="showChildren">
Show all errors in the parent form's <code>form-errors</code>.
</label>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js"></script>
<script src="formErrors.js"></script>
<script src="demo.js"></script>
</body>
</html>