After implementing the sharing functionality, I have noticed that it works fine but there is a repeating issue with the user list. Every time the 'a' tag is clicked multiple times, the user list gets repeated. Can someone guide me on how to resolve this repetition problem?
//CONTOLLER FOR SHARING
$scope.selectedSharedBuyerKeyList = [];
$scope.selectedSharedBuyerObjectList = [];
$scope.productObjectForShareModal = [];
$scope.getConnectedSharedUser = function(product) {
$scope.productObjectForShareModal = product;
var data = {
productKeyId : $scope.productObjectForShareModal.keyId
}
//Call the getSharedUserList function to obtain details of connectedUsers
SellerDashboardService.getSharedUserList(function(response) {
if(response != null) {
if (response.data.isProduct) {
$scope.selectedSharedBuyerKeyList = response.data.sellerProductsDto;
// Obtain user objects.
$scope.selectedSharedBuyerObjectList = [];
for(var selectedSharedBuyerKey of $scope.selectedSharedBuyerKeyList) {
var data = selectedSharedBuyerKey;
//call the getBuyerInShared to get the list of buyer objects
SellerDashboardService.getBuyerInShared(function(response) {
if(response != null) {
if (response.data.isbuyer) {
var buyerObject = response.data.isbuyer;
$scope.selectedSharedBuyerObjectList.push(buyerObject);
}
}
},data);
}
}
}
},data);
}
<a href="#" class="fa fa fa-group btn btn-xs pull-left bg-color-d4"
data-toggle="modal" data-target="#groupModal"
ng-click="getConnectedSharedUser(productDBList)">
</a>