Closed sharathm89 closed 7 years ago
The only solution I can think of is creating a new options object for each custom select, and passing the index to the factory function; something like:
<div ng-repeat="guest_detail in guest_details track by $index">
<div custom-select="g for g in guest_names | filter: $searchTerm"
ng-model="offlineForm.name[$index]" custom-select-options="getGuestNameOptions($index)"></div>
</div>
And in your controller:
$scope.getGuestNameOptions = function (index) {
return {
onSelect: function (item) {
// here you have access to the index value
},
onAdd: function (text) {
// here you have access to the index value
}
};
};
thanks it worked.
Above is my code and i have a scenario where i need to pass the loop's index to guestNameOptions. Is it possible or any other way is there where i can capture the index and handle in onSelect, onAdd callbacks.