Below is the html code snippet I am working with:
<li ng-repeat="friend in friends">
<span ng-repeat="(key, value) in friend.aktuell">
<input type="text" ng-model="friend.aktuell[key]">
</span>
<quick-datepicker ng-model="auditDate"></quick-datepicker>
<button ng-click="audit(auditDate, friend._id)" class="btn btn-info">Audit</button>
</li>
The challenge I'm facing is updating only the input fields of the specific friend[index]
that has been clicked by the audit button.
For example:
$scope.audit = function(auditDate, id){
$scope.friends[1].aktuell = {someData:someValues}; // this works if the index is hard coded
});
};
The above code successfully updates when 'friends[1]' is hardcoded into the function call, but I need to update the clicked field dynamically.
Ideas: Is there a way to pass the index of the clicked element to my audit function or can I modify the input fields based on "friend._id = friend._id"?
Screenshot: