How to tell which bootstrap tab is selected in Angular-UI

前端 未结 5 2104
执笔经年
执笔经年 2020-12-23 20:26

Is there a way to tell which tab that has been selected when using the Bootstrap tabs in Angular UI?

I tried watching the panes array but it deosn\'t seem to be upda

5条回答
  •  悲&欢浪女
    2020-12-23 21:10

    I solved it by adding one method (onTabSelect) on the controller and calling it from ng-click event of Tab. Below solution worked for me please see this in action

    function myTabController($scope) {
      $scope.onTabSelect = function(tabName) {
        $scope.selectedTabName = tabName;
        console.log("Changed tab to " + tabName);
      }
    
    
      
        
          
            A
          
        
        
          
            B
          
        
      
    

提交回复
热议问题