-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
79 lines (64 loc) · 3.15 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!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-6 col-md-offset-3 col-sm-10 col-sm-offset-1">
<form ng-class="{ 'show-errors': emitErrors }" name="loginForm" emit-errors="{{emitErrors}}" ng-submit="submit()" role="form" error-messages="errorMessages" novalidate>
<h4>This is a <code>form</code> element with <code>name="loginForm"</code></h4>
<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" emit-errors="{{emitErrors}}" novalidate>
<h4>This is an embedded <code>ng-form</code> with <code>name="moreInfoForm"</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="emitErrors">ngForm Errors:</p>
<form-errors form-name="moreInfoForm" class="list-unstyled"></form-errors>
</div>
<p ng-show="emitErrors">Form Errors:</p>
<form-errors form-name="loginForm" 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">See all errors in the app.
</label>
<div ng-show="showChildren">
<div ng-repeat="(formName, formErrors) in errors">
<strong>{{formName}}:</strong>
<ul class="form-errors">
<li class="form-error" ng-repeat="error in formErrors">
{{ error.message }}
</li>
</ul>
</div>
</div>
</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>