How to reset content scroll

Hi , I am using a list component on a <content> and i have enabled the scrolling of the <content>. I am filtering the list’s contents dynamically. My problem is when i am at the bottom of the page by scrolling down and then filter my list then it doesn’t scroll up. I have tried updating the <content> size by $scope.$broadcast('scroll.resize') but its not helping. Is there a way to reset the scroll of <content>. I am temporarily applying a solution but it involves DOM manipulation inside controller which is not a good idea as per Angular’s practices.

Hey @saurabhgupta050, I just pushed a change that lets you scroll to the top of the viewport.

What you can try is

$scope.$broadcast('scroll.scrollTop')

after you’ve changed the list. You can also try using the new ScrollDelegate system I just added. To do that, inject the ScrollDelegate object into your controller and call ScrollDelegate.scrollTop(false) to immediately snap to the top of the scroll port. Change false to true to animate.

Does that help?

1 Like

hei,can i ask you how to scroll to bottom of the list ? is there a way to call function of the scroll without $scope.$broadcast(‘xxxx’) ,such as to call resize of the scroll.

@max hei,can i ask you how to scroll to bottom of the list ? is there a way to call function of the scroll without $scope.$broadcast(‘xxxx’) ,such as to call resize of the scroll. i want to jump to the bottom by call a function

Hi there , it seems there is a problem in using ScrollDelegate system. I have taken latest update from git and now i am having ScrollDelegate Provider error. Have this system being removed from ionic.

it is works , you mast import it at the controller object function(ScrollDelegate), then you can work with it.

it looks as though the inject changed to $ionicScrollDelegate

$ionicScrollDelegate.scrollTop(animate)
1 Like

I am facing the same problem. I am trying some way. One way (I think not so good) is refresh current state. I tested on iOS and it works fine, android is little laggy.

You can try: $state.go($state.current, {}, {reload: true});

According to this issue: http://stackoverflow.com/questions/25192172/force-view-to-reload-in-ionic-framework