javascript - Angular + bootstrap-ui, check if current tab is already active -


i hooking function onto tab click call data server. have firing when click specific tab, rid of instance of being on tab , clicking - , call server firing again (not needed). using angular + angular-bootstrap-ui.

so tried hook function on tab check if if active seems once ng-click on fired, has been set active. no matter when click it return active. need kind of way check if on tab. here's tried

   <tabset> {{tabs.active}}     <tab heading="tree" >      </tab>     <tab heading="xml" active="tabs.active" ng-click="checktab(tabs.active)">       </tab> </tabset> 

and in controller

  $scope.checktab = function(check){         console.log(check);         } 

and so, no matter what, return true because seems .active set true before click fires. there way around this? thanks!

update : fiddle - https://jsfiddle.net/7ognp2nj/2/

i suggest using select instead of ng-click. this:

    <tab heading="tree" select="checktab('tab 1 selected')">        tab1     </tab>     <tab heading="xml" select="checktab('tab 2 selected')">        tab2     </tab> 

checktab not invoked when click on active tab. runs when click on inactive tab. executed once without clicking when tabs displayed first time. looks desired behavior.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -