Can I bind an action to a tab bar button?

click the button not go other page , just run some code.
thanks.

I think you’d really be fighting a losing battle to try to make that happen. Tabs are designed for windowed content. The controller for the tab component is designed to show different content based on which tab you are in.

If you want tab like buttons without actual tabs, I’d suggest putting icons / buttons in a footer. That way you get to do things based on clicks and aren’t trying to fight the built-in logic of tabs.

Here’s a rough sample:

1 Like

I found the answer !
http://ionicframework.com/docs/angularjs/controllers/tab-bar/

at the bottom of the page.
it works great !

<ion-tabs tabs-type="tabs-icon-only">
  <ion-tab title="Home" icon-on="ion-ios7-filing" icon-off="ion-ios7-filing-outline" ng-controller="HomeCtrl">
    <ion-header-bar type="bar-positive" title="'Home'"></ion-header-bar>
    <ion-content has-header="true">
      <h2>Home Content</h2>
    </ion-content>
  </ion-tab>
</ion-tabs>

angular.module('test', ['ionic'])
.controller('HomeCtrl', function($scope) {
  $scope.$on('tab.shown', function() {
    // Maybe load some content here
  });
  $scope.$on('tab.hidden', function() {
    // Perhaps cycle out some data in memory here
  });
});

I apologize for not understanding your intent. I thought you didn’t want tapping the tab bar to actually switch to another tab. Good job finding the solution.