$ionicTabsDelegate
Delegate for controlling the ionTabs directive.
Methods called directly on the $ionicTabsDelegate service will control all ionTabs directives. Use the $getByHandle method to control specific ionTabs instances.
Usage
<body ng-controller="MyCtrl">
<ion-tabs>
<ion-tab title="Tab 1">
Hello tab 1!
<button ng-click="selectTabWithIndex(1)">Select tab 2!</button>
</ion-tab>
<ion-tab title="Tab 2">Hello tab 2!</ion-tab>
</ion-tabs>
</body>
function MyCtrl($scope, $ionicTabsDelegate) {
$scope.selectTabWithIndex = function(index) {
$ionicTabsDelegate.select(index);
}
}
Methods
select(index)
Select the tab matching the given index.
| Param | Type | Details |
|---|---|---|
| index |
number
|
Index of the tab to select. |
selectedIndex()
- Returns:
numberThe index of the selected tab, or -1.
showBar(show)
Set/get whether the ionTabs is shown
| Param | Type | Details |
|---|---|---|
| show |
boolean
|
Whether to show the bar. |
- Returns:
booleanWhether the bar is shown.
$getByHandle(handle)
| Param | Type | Details |
|---|---|---|
| handle |
string
|
- Returns:
delegateInstanceA delegate instance that controls only theionTabsdirectives withdelegate-handlematching the given handle.
Example: $ionicTabsDelegate.$getByHandle('my-handle').select(0);