angular ui tab未侦听select在检查Dirty标志时,Deselect未取消选择新选项卡

时间:2016-04-29 14:20:57

标签: angularjs angular-ui-bootstrap bootstrap-modal angular-ui-tabset

我必须在滚动浏览不同标签时实施脏检查。 但是当我试图实现这个select()和deselect()方法时,角度ui tab没有监听并停止导航到另一个标签。

我明确地让他们活跃但仍然没有运气。

您能否帮我调试此问题或为我提供解决方法?

Dashboard.html

<uib-tabset active="active">
    <!--  <uib-tab heading="Dashboard" index="0">
        <ng-include src="'/project/Dashboard.html'">
        </ng-include>
     </uib-tab> -->
    <uib-tab  index="$index" ng-repeat="tab in tabs" heading="{{tab.title}}" active="tab.active" 
    deselect="switchTabs(tab)" select="selectTab(tab)" disable="tab.disabled">
    <uib-tab-heading>
           {{tab.title}} <i class="glyphicon glyphicon-remove" ng-click="removeTab($index)" ng-hide="tab.tabId===-1"></i> 
     </uib-tab-heading>
      <ng-include src="tab.templateUrl">
      </ng-include>
    </uib-tab>
 </uib-tabset>

DashboardCtrl.js

$scope.tabs = [];
$scope.activeTab = 0;
$scope.selectTab = function(tabInfo) {


console.log("tab Info"+tabInfo.title);

if($scope.activeTab > 0)
{
$scope.tabs[$scope.activeTab].active=true;
$scope.active = $scope.activeTab;
}

};


$scope.switchTabs = function(tabInfo) {
$scope.prevActiveTab = tabInfo.tabId;
var tabNumbers = $scope.tabs.length;
var tabActivateId = -1;
for(var i=0; i<tabNumbers; i++)
{
if($scope.tabs[i].tabId === tabInfo.tabId)
{
tabActivateId = i;
}

}

if(tabActivateId>=0)
{
$scope.tabs[tabActivateId].active=true;
$scope.active = tabActivateId;
$scope.activeTab = tabActivateId;
}


if($scope.isViewDirty === true)
{
event.preventDefault();
event.stopPropagation();
openConfirmationModal('sm');


}
else
{
$scope.isViewDirty = false;
}



};

这不是正在侦听任何事件,也不是正确选择活动标签。

Angular JS Version 1.4.3 Bootstrap版本0.14.3

0 个答案:

没有答案