vendredi 27 février 2015

Input text Box Validation inside ng-repeat

Am having a ng-repeat function wherein am displaying 3 input text boxes.But the sane button dosen't seem to apply validations(I need to enable 'Save' button only if I fill all the three inputs)



<form name="myForm" novalidate>
<div ng-repeat="item in items">
<input type="text" ng-model=item.name required class="form-control">
</div>
</form>
<button type="button" ng-disabled="myForm.$invalid" ng-click="save()">Save</button>


Controller:



$scope.items=[{
id:1,
name:VALUE1
},{
id:2,
name:VALUE2
},{
id:3,
name:VALUE3
}]

Aucun commentaire:

Enregistrer un commentaire