JKnorr91 / ion-slide-box-tabs

An Add-On directive for the ion-slide-box, that adds tabs to the slide box, known from the Android Material Design specification
MIT License
248 stars 110 forks source link

Question: How to get the current selected tab #15

Open LuisMCunha opened 8 years ago

LuisMCunha commented 8 years ago

Hi,

I'm trying to do something similar to ng-click when the user selects a specific tab, but setting ng-click on the ion-slide element binds the event to the content and not the tab element itself. How would I be able to detect when a single tab is selected?

albertonaperijr commented 8 years ago

I guess you can only get the index of the current slide/tab. Just add active-slide="slides.active" attribute in ion-slide-box tag then you will get the index by using $scope.slides.active in your controller.

Hope this helps.

LuisMCunha commented 8 years ago

I ended up using this with

      $scope.slideChanged = function (index) {
        switch (index) {
          case n:
          //do something
        }
      };

As I need to do something different depending on which tab is selected, which is very similar to your suggestion. Thanks.