@@ -37,10 +37,10 @@ Let's start with input fields for quantity and cost whose values are multiplied
37
37
<div ng-app ng-init="qty=1;cost=2">
38
38
<b>Invoice:</b>
39
39
<div>
40
- Quantity: <input type="number" ng-model="qty">
40
+ Quantity: <input type="number" min="0" ng-model="qty">
41
41
</div>
42
42
<div>
43
- Costs: <input type="number" ng-model="cost">
43
+ Costs: <input type="number" min="0" ng-model="cost">
44
44
</div>
45
45
<div>
46
46
<b>Total:</b> {{qty * cost | currency}}
@@ -128,10 +128,10 @@ different currencies and also pay the invoice.
128
128
<div ng-app="invoice1" ng-controller="InvoiceController as invoice">
129
129
<b>Invoice:</b>
130
130
<div>
131
- Quantity: <input type="number" ng-model="invoice.qty" required >
131
+ Quantity: <input type="number" min="0" ng-model="invoice.qty" required >
132
132
</div>
133
133
<div>
134
- Costs: <input type="number" ng-model="invoice.cost" required >
134
+ Costs: <input type="number" min="0" ng-model="invoice.cost" required >
135
135
<select ng-model="invoice.inCurr">
136
136
<option ng-repeat="c in invoice.currencies">{{c}}</option>
137
137
</select>
@@ -228,10 +228,10 @@ Let's refactor our example and move the currency conversion into a service in an
228
228
<div ng-app="invoice2" ng-controller="InvoiceController as invoice">
229
229
<b>Invoice:</b>
230
230
<div>
231
- Quantity: <input type="number" ng-model="invoice.qty" required >
231
+ Quantity: <input type="number" min="0" ng-model="invoice.qty" required >
232
232
</div>
233
233
<div>
234
- Costs: <input type="number" ng-model="invoice.cost" required >
234
+ Costs: <input type="number" min="0" ng-model="invoice.cost" required >
235
235
<select ng-model="invoice.inCurr">
236
236
<option ng-repeat="c in invoice.currencies">{{c}}</option>
237
237
</select>
@@ -356,10 +356,10 @@ The following example shows how this is done with Angular:
356
356
<div ng-app="invoice3" ng-controller="InvoiceController as invoice">
357
357
<b>Invoice:</b>
358
358
<div>
359
- Quantity: <input type="number" ng-model="invoice.qty" required >
359
+ Quantity: <input type="number" min="0" ng-model="invoice.qty" required >
360
360
</div>
361
361
<div>
362
- Costs: <input type="number" ng-model="invoice.cost" required >
362
+ Costs: <input type="number" min="0" ng-model="invoice.cost" required >
363
363
<select ng-model="invoice.inCurr">
364
364
<option ng-repeat="c in invoice.currencies">{{c}}</option>
365
365
</select>
0 commit comments