javascript - How to get the active tab in Ionic -
i have tabs inside modal code:
<ion-tabs class="tabs-positive tabs-top"> <ion-tab title="find"> <ion-view> <ion-content> <div class="list list-inset"> <label class="item item-input"> <i class="icon ion-search placeholder-icon"></i> <input type="text" ng-model="data.sight" placeholder="find events or people" ng-change="searchsight()"> </label> </div> </ion-content> </ion-view> </ion-tab> <ion-tab> ... more tabs </ion-tab> </ion-tabs>
and have footer button want perform particular action according active tab, how active tab in ionic?
thank much!
you selected index of tab using $ionictabsdelegate, possibly determine action take.
function myctrl($scope, $ionictabsdelegate) { if ($ionictabsdelegate.selectedindex() == 0){ // perform action } }
use $getbyhandle method control specific iontabs instances.
example:
$ionictabsdelegate.$getbyhandle('my-handle').selectedindex();
explained in further detail @ $ionictabsdelegate api documentation
Comments
Post a Comment