How to disable auto scrolling in ionic app

Please can you guide me on how to disable auto scrolling when location.hash() is called.
In the angularjs documentation, it is written that you need to add $anchorScrollProvider.disableAutoScrolling() in the config file. But I don't seem to know how to achieve that in appery.io.
Thanks
1 person has
this question
+1
Reply
  • Hello,

    Please clarify, what functionality exactly do you need to have there?
    Do you build the web application or mobile application? Do you need to read URL parameters to send variables between pages?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned

  • Hi Serhii,

    Thanks for your prompt reply. I am developing a mobile and I am trying to implement a functionality such that when one clicks on an alphabet (Say G) which is which is an item in list of alphabets by the right side of the screen, a scroll bar by the left will scroll its content to the first item starting with clicked alphabet in its list.

    Now the problem is; when you click the letter, instead of the scroll bar scrolling, it tries to scroll the entire page including header and footer.

    The code I am using to achieve that is this scope function with key as parameter:

    var $location = Apperyio.get('$location');
    var $anchorScroll = Apperyio.get('$anchorScroll');
    var $ionicScrollDelegate = Apperyio.get('$ionicScrollDelegate');
    var $route = Apperyio.get('$route');
    var $rootScope = Apperyio.get('$rootScope');

    $location.hash(key);

    var lastRoute = $route.current;
    var un = $rootScope.$on('$locationChangeSuccess', function () {
    $route.current = lastRoute;
    });

    //The below section does not take effect because of the problem
    var handle = $ionicScrollDelegate.$getByHandle('itemscroll');
    handle.anchorScroll(true);

    Upon research, I saw the angularJS documentation that says that the page will automaticall scroll to the specified hash unless if auto scrolling is disabled using $anchorScrollProvider.disableAutoScrolling() in the config file after which scrolling can only be achieved by explicitly calling anchorScroll() afer location.hash().
    The documentation link can be found here:
    docs.angularjs.org/api/ng/provider/$anchorScrollProvider

    Thanks
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned