Reputation: 33
Thank you. In my form there are some dynamic input text boxes created by using ng-repeat. How to get the values of these text boxes when submit the form using Angular js?
<form ng-submit="submit()">
<div ng-repeat="opt in option">
<input type="text" name="">
</div>
</form>
Upvotes: 0
Views: 1161
Reputation: 2232
Use ng-model to bind the input values and $index for that particular index in the repeated values.
$scope.inputData = [];
inputData will have the binded values.
<form ng-submit="submit()">
<div ng-repeat="opt in option">
<input type="text" name="" ng-model="inputData[$index]">
</div>
</form>
Upvotes: 1
Reputation: 1032
Not sure of what you want but guess this will help you
<div ng-app="myApp" ng-controller="myController">
<input type="text" ng-model="data[$index].Name" ng-repeat="num in numbers track by $index"/>
<p ng-repeat="dataObj in data track by $index">
{{dataObj.Name}}
</p>
</div>
I have created a fiddle here
Upvotes: 1