Reputation: 315
I have a list of json objects. Each object has minage
and maxage
.
I want to ng-repeat
on this object and display input to enter the minAge
and input for maxAge
.
I want to add validation for the fields:
Upvotes: 0
Views: 1547
Reputation: 2954
You can use min
and max
arguments within your inputs to achieve this:
<div ng-repeat="range in ages">
minAge: <input type="number" min="{{ages[$index-1]['MaxAge']}}" max="{{range.MaxAge}}" ng-model="range.MinAge" />
maxAge: <input type="number" min="{{range.MinAge}}" ng-model="range.MaxAge" />
</div>
Upvotes: 1