Have slidebox change event?


First of all thanks for this great framework!

I’m doing a Login/splash page like “Path” (app for android and ios), that has a slider of images and texts.
But they made change of images with fade, i can do that too if is possible slidebox provide any change event.

There is?


The slideBox directive allows the attribute on-slide-changed to be configured. So, you can put whatever method you want there.

Example :

<slide-box on-slide-changed="slideChanged(index)">

Then, in your controller, you have something like this:

$scope.slideChanged = function(index) { switch(index) { case 0: console.log('I am on slide 0'); break; case 1: console.log('I am on slide 2'); break; } };


Thank U!
I will test right now!


You can also watch the slideBox. slideChanged event, something like this:

scope.$on('slideBox.slideChanged', function (event, index) {
    console.debug('Slide box has been changed, current index is ' + index);

Read more in source code of ionic project, and this is the example(open your chrome/firefox console to see the effect).

UPDATED: 06/07

i try to use your code but it it tell that scope is not defined :unamused:


It depends on what case you are, see the above example.

thank u so much!
but the code of @Calendee have worked well… in 2013 hehehe :smiley: Thanks!

WOW, i did not notice the date of the comment posted.

:smile: Yeah, what @Calendee did is recommended, i just want to tell someone that there has a different way to complete this requirement, if my comment did help you too, i will be very happy! Thank you, @moody404 and @malkafly!