Ionic 2 rc4 addScrollListener

hi,

I have the code like

  @ViewChild(Content) content: Content;
...
   this.content.addScrollListener((event) => {
...

installed 2.0.0-rc.3-201612122136 which in my mind is predecessor of rc4, and now it stopped working

how it should be written for upcoming rc4?

1 Like

Oh dude, You scared me. I thought this was the actual RC4 lol.

I believe it stays the same

no, in current build there is no addScrollListener for Content.
Just check documentation.

you also can check sources

+1 ( Property ‘addScrollListener’ does not exist on type ‘Content’.)

In RC.4 you could do:

content.ionScroll.subscribe(($event: any) => {
}

where content is content: Content

6 Likes

seems like your solution works, but I still can’t port my code to rc4, it hangs

1 Like

what hangs? do you have another issue open on the forum?

Got the same problem. It works with this solution.

Sorry for the late reply.

My app hanging, should debug this deeper, but decided to move forward with rc3, and update only after Ionic release, because every rc update takes 2-3 days of development just to fix stuff.

I should say for me, this time at least, the update from RC.3 to RC.4 took like max a half day, but of course, depends of the app

changing the code took 10 minutes, but app just hangs in random plase, so debug will take disabling all components and turning them one by one, too much for simple useless switch.
Better to wait until release.

I could understand that, good luck

@theromis hi , have you found a work around this…addScrollListener in RC 4

I’m not sure if this helps, but it worked fine in my app:

            this.content.ionScroll.subscribe(($event) => {
                this.scrollAmount = $event.scrollTop;
            });

yes, subscribe works perfect

1 Like

You are my HERO,
Working fine.

Thanks.