My current scenario is: I've doing nesting repetition like follow:
<form name="task_form" ng-app="myApp" ng-submit="tasksubmit()">
<ul class="items-list">
<li ng-repeat="task in taskslist | orderBy:orderProp">
<p>
<strong>{{task.title}}</strong>
</p>
<input type="text" ng-model="task.input_value">
</li>
</ul>
</form>
If in tasklist
array i have 100+ tasks then it means i have more then 100 same ng-model
values for <input type=text>
. Here problem is that how can i get the values for <input type = text>
against any task.id
so that i can use those input values for my further use.
You can use an object - make the task.id
as the key:
$scope.taskValues = {};
And the view:
<input type="text" ng-model="taskValues[task.id]">
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.