I have dynamic tabs (Angular UI Bootstrap), in my opinion:
<uib-tabset active="1" id="tabs" class="col-md-10">
<uib-tab ng-repeat="tab in filaCtrl.tabs" ng-click="filaCtrl.getChatTab(tab.protocolo)">
<uib-tab-heading >
<div style='display: flex; align-items: center; justify-content: center;'>
<h5 style='margin-right: 10px;'>Protocolo: {{tab.protocolo}}</h5>
<h7 ng-md-icon icon='cancel' style='fill:#F44336' size='16' ng-click='filaCtrl.closeTab(tab.protocolo, $index)'><h7>
<div>
</uib-tab-heading>
<div class="tab-content">
(...)
My filaCtrl.closeTab () function removes the tab, i.e. element in the filaCtrl.tabs array. But when the item is deleted, the view is updated and "closes" all tabs, that is, it refreshes the page.
self.closeTab = function (protocolo, $index) {
self.tabs.splice($index, 1);
};
How can I delete an item without refreshing my page?
source
share