How to get Events on individual controllers of slide box


#1

Hi,

I have 2 html files, view1.html and view2.html. Both html’s are associated with there individual controllers.

I have added the both html files in slide box

<ion-slide ng-repeat="item in items">
    <div ng-include=item.url></div>
</ion-slide>

$scope.items = [{
	url : 'view1.html'
}, {
	url : 'view2.html'

Is there any event that can be triggered on view1/view2 controller when it gets focus or blur?

Thanks,
Venkat.


#2

You can use the on-slide-changed attribute to notify your controllers when the slide has changed.


#3

on-slide-changed is not working…

I tried to listen at view1 controller. But am not getting any event.

#4

Why don’t you post a CodePen sample. I can take a look at it then.


#5

Actually, I updated my old one to Beta 5b.


#6

I have added a new method called “slideChanged_new”…

Thanks,
Venkat.


#7

Added small piece of code on top of codepen shared by you.

As mentioned in my first query, event that can be triggered when that view comes into focus.


#8

RE : http://codepen.io/anon/pen/EqpzK: This example is ancient. It’s from 0.9.26. Just don’t use it. I don’t think on-slide-changed existed then.


#9

I don’t see what you have changed from my example. In any case the on-slide-changed event is firing properly. If you look at the console, you will see it is getting logged.


#10

Hi,

Can you please check now in the following url

I have added the following method in tag.
reportSlideChanged1

I have View1.html and View2.html which has webservices post every 30sec’s. So when View1 is active, I dont want to call View2 webservice. And vice versa, when view2 is on focus, view1 should stop his web service request and only view2 should call its webservices.

So is there any way to know whether view1/View2 is focus/blur.

Thanks,
Venkat.


#11

on-slide-changed only works on the entire ion-slide-box, not on individual ion-slides.

Since the on-slide-changed tells you which slide you are currently on, you can just use that info to decide what data to fetch, right?

Sample : http://codepen.io/calendee/pen/evfhd