Skip to content

Commit 1d3e79e

Browse files
jaredbeckpetebacondarwin
authored andcommitted
docs(overview): correct the input validation example
The documentation says that the input should be red if you enter invalid values or leave it blank. Because the type="integer" is not supported this does not happen in practice. This fix changes the input type to number and adds an ng-pattern to ensure that the number is an integer.
1 parent 120b919 commit 1d3e79e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/content/guide/overview.ngdoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ concepts which the application developer may face:
9090
<table>
9191
<tr><td>Quantity</td><td>Cost</td></tr>
9292
<tr>
93-
<td><input type="integer" min="0" ng-model="qty" required ></td>
93+
<td><input type="number" ng-pattern="/\d+/" step="1" min="0" ng-model="qty" required ></td>
9494
<td><input type="number" ng-model="cost" required ></td>
9595
</tr>
9696
</table>
@@ -124,7 +124,7 @@ We load Angular using the `<script>` tag:
124124
From the `ng-model` attribute of the `<input>` tags, Angular automatically sets up two-way data
125125
binding, and we also demonstrate some easy input validation:
126126

127-
Quantity: <input type="integer" min="0" ng-model="qty" required >
127+
Quantity: <input type="number" ng-pattern="/\d+/" step="1" min="0" ng-model="qty" required >
128128
Cost: <input type="number" ng-model="cost" required >
129129

130130
These input widgets look normal enough, but consider these points:

0 commit comments

Comments
 (0)