There is a modal that appears when a button is clicked. Inside the modal, there is a list of items that is populated by data from a GET request response stored in the controller.
The issue arises when the modal is opened multiple times, causing the list to momentarily duplicate - showing one copy for each click before resolving itself to the actual content of the list.
Could this problem be related to the controller, HTML, or is it possibly a side-effect of ngRepeat?
Here are snippets of code from the HTML file:
<li ng-repeat="itemin vm.items">{{item.name}}</li>
<a href="#" onclick="togglePanel('Panel')" ng-click= "vm.getItems()">View Items</a>
And here is part of the controller code:
getItems(): angular.IPromise<core.IItem> {
var self: Controller = this;
return this.itemDataService.getItems()
.then(function(response: any): angular.IPromise<core.IItem> {
self.items = response.data;
return response;
},
function(response: any): angular.IPromise<core.IItem> {
self.items = [];
return response;
});
}
If more code is needed, please let me know.
Edit: Additional code snippet... The onClick function being called:
function toggleSavedSearchPanel(id)
{
var e = document.getElementById(id);
if (e.style.display == 'block' || e.style.display=='')
{
e.style.display = 'none';
}
else
{
e.style.display = 'block';
e.focus();
}
}