ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

Content.addScrollListner can't read class variables

Open warnerpinz opened this issue 10 years ago • 1 comments

Short description of the problem:

Content.addScrollListner can't read class variables

What behavior are you expecting?

I want to access the instance variable on page scroll.

Steps to reproduce:

  1. Use the sample code from the Ionic2 documentation http://ionicframework.com/docs/v2/2.0.0-alpha.55/api/components/content/Content/
  2. I see the console output saying 'They see me scrolling...'
  3. Adding an instance variable ctr:number = 1;
  4. Upon scrolling in content, I still see the message 'They see me scrolling...' but the prints "NaN" in the console log.
insert any relevant code between the above and below backticks

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)

Which Ionic Version? 1.x or 2.x

Run ionic info from terminal/cmd prompt: (paste output below)

warnerpinz avatar Apr 03 '16 06:04 warnerpinz

Try using this.content.addScrollEventListener(this.myScroll.bind(this));

adamdbradley avatar Apr 05 '16 19:04 adamdbradley