Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ionContent onScrollComplete parameters undefined #2464

Closed
cquartier opened this issue Oct 29, 2014 · 3 comments
Closed

ionContent onScrollComplete parameters undefined #2464

cquartier opened this issue Oct 29, 2014 · 3 comments

Comments

@cquartier
Copy link

In content.js, line 126:

scrollingComplete: function() {
  $scope.$onScrollComplete({
    scrollTop: this.__scrollTop,
    scrollLeft: this.__scrollLeft
  });
}

The scrollTop and scrollLeft parameters are undefined, because this is a reference to the scrollViewOptions object, and the members __scrollTop and __scrollLeft are never populated as far as I can tell.

codepen example (you'll need to look at console logs to see result of on-scroll-complete handler)

@drewrygh
Copy link
Contributor

I'll have to look in to this some more, but it looks like you never define scrollTop and scrollLeft on your scope, but you're trying to pass them in as arguments in your scrollingComplete method. I don't believe scrollTop and scrollLeft are meant to be returned or even accessed - they're there to track the scroll position internally. Does that make sense?

@drewrygh drewrygh added scroll needs: reply the issue needs a response from the user labels Oct 31, 2014
@cquartier
Copy link
Author

@drewrygh the scrollingComplete function I show above is in the ionic library, not my code. Did you see my codepen example?

This is a problem with the ionContent directive. https://github.com/driftyco/ionic/blob/master/js/angular/directive/content.js#L126

html example:

<ion-content ng-controller="MyCtrl" on-scroll-complete="scrollFinish(scrollTop, scrollLeft)">

js example:

MyApp.controller('MyCtrl', function($scope) {
  $scope.scrollFinish = function(scrollTop, scrollLeft) {
    console.log('onScrollComplete');
    console.log(scrollTop);
    console.log(scrollLeft);
  };
});

I can get the onScrollComplete console message, but scrollTop and scrollLeft are undefined.

Am I not doing something right? I'm pretty sure this is all I need to do.

If __scrollTop and __scrollLeft are supposed to be internal then maybe the directive should be updated and the onScrollComplete function delegate should not pass them in as parameters.

@cquartier
Copy link
Author

@drewrygh did you check into this any further?

@Ionitron Ionitron removed the needs: reply the issue needs a response from the user label Jan 19, 2015
@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants