Ionic ion-side-menus side menu fire scroll to in side content


#1

Hey, I want to click the items in side menu and side content scrolls, but it seems does not work, please see this.


#2

Try this.

  $scope.slideTo = function(location) {
    location = $location.hash(location);
    console.log('scrolling to: '+location);
    $ionicScrollDelegate.$getByHandle('mainScroll').anchorScroll("#"+location);
    //$ionicScrollDelegate.$getByHandle('mainScroll').scrollTo(0, 300, true);
  };

Or this.

<a id="{{group.name}}" class="item item-stable item-icon-left item-icon-right"ng-click="scrollMe(group.name)"><a>

Then this js

$scope.scrollMe = function (anchor) {
  $location.hash(anchor);

  $timeout(function () {
    $ionicScrollDelegate.anchorScroll(true);
  }, 200);
};

#3

Thank you so much, but I still have problem when I tried to bind to async loaded data, the example here
http://codepen.io/anon/pen/jqdKc is fine, but when I got $scope.ids from $http.get, I clicked and location hash changed but it flashed and does not scroll, please help me with this, So sorry to bother you, thank you again.


#4

Hey no worries, this is why I’m here :smile:

So is it possible for you to create an example using $http.id?


#5

sorry for late replay, I finally found that my problem is about scroll id binding on list item, so I changed that and I solved it. thank you for your generous help.
And now I come up with another problem, it’s about ion-nav-bar ion-nav-back-button, it actually functions well, but I found that sometimes in some special pages, when I clicked back button, I want to navigate to other page other than previous, is there a way to do this? or is there a way to add ion-nav-bar and ion-nav-back-button in ion-view and do navigation?
Thank you so much.