user1469734
user1469734

Reputation: 801

ionic tabscontroller make not-first active on startup

When you start an ionic application with a tabbar on the bottom, it always starts the App with the first Tab active.

But I have 3 tabs, and I want the Tab in the middle to be the active Tab that starts when I open the App.

Can't find in the docs how to do this. Someone?

Upvotes: 0

Views: 36

Answers (1)

niklas
niklas

Reputation: 3011

There is $ionicTabsDelegate for your needs. You can inject it into any controller, or your app's run block. Then you do it similar to the example:

function MyCtrl($scope, $ionicTabsDelegate) {
  //use 1 to select the second tab (starts with 0)
  $ionicTabsDelegate.select(1);
}

if you want to have it when your app starts, put in in your run block

Upvotes: 1

Related Questions