Skip to content

Commit 64b8eee

Browse files
committed
Add ng-repeat input box example
How to make it support multiple input box for the same validator #63
1 parent 8b1b46f commit 64b8eee

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

demo/demo.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@
141141
}
142142
};
143143

144+
$scope.form6 = {
145+
required: [{}, {}, {}], // ng-repeat
146+
checkValid: $validationProvider.checkValid
147+
};
148+
144149
// Callback method
145150
$scope.success = function (message) {
146151
alert('Success ' + message);

index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,23 @@ <h1>Angular Validation.
217217
<!-- <pre>{{ form | json }}</pre> -->
218218
</form>
219219
</div>
220+
221+
<div class="small-12 medium-12 large-6 columns">
222+
<form name="Form6" id="form6">
223+
<fieldset>
224+
<legend>Form (ng-repeat)</legend>
225+
<label>Required</label>
226+
<input type="text" name="emailRequiredOnly{{$index}}" ng-model="a.required" validator="required" ng-repeat="a in form6.required"/>
227+
</fieldset>
228+
229+
<ul class="button-group">
230+
<li><button class="button" validation-submit="Form6">Submit</button></li>
231+
<li><button class="button alert" validation-reset="Form6">Reset</button></li>
232+
<li><button class="button secondary" ng-disabled="!form6.checkValid(Form6)">checkValid = {{ form6.checkValid(Form6) }}</button></li>
233+
</ul>
234+
<!-- <pre>{{ form | json }}</pre> -->
235+
</form>
236+
</div>
220237
</div>
221238

222239
<a href="https://github.com/huei90/angular-validation"><img src="demo/iconmonstr-github-10-icon-128.png" id="github-link" alt="Fork me on Github"/></a>

0 commit comments

Comments
 (0)