简体   繁体   中英

ui.bootstrap.tabs how to know which tab is active in angularjs controller

I have two tabs in my tab set on html:

<tabset justified="true" style="padding:13px">
    <tab heading="Static profit" >
        content one                         
    </tab>
    <tab heading="Dinamic profit" >
        content two                         
    </tab>
</tabset>

My question is how to know in controller which tab is active. I want show/hide outside div depending of active tab.

Try like this

<tabset justified="true" style="padding:13px">
    <tab heading="Static profit" ng-click="onTabSelect('tab1')" >
        content one                         
    </tab>
    <tab heading="Dinamic profit" ng-click="onTabSelect('tab2')">
        content two                         
    </tab>
</tabset>

js

$scope.onTabSelect=function(tabName){
  console.log(tabName);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM