# How to make the sccollbar of content element scroll down to the bottom automatically

**URL:** <https://forum.ionicframework.com/t/how-to-make-the-sccollbar-of-content-element-scroll-down-to-the-bottom-automatically/393>\
**Category:** ionic-v1\
**Created:** [January 3, 2014, 7:17am UTC](https://forum.ionicframework.com/t/how-to-make-the-sccollbar-of-content-element-scroll-down-to-the-bottom-automatically/393 "2014-01-03T07:17:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhenghaihui](https://avatars.discourse-cdn.com/v4/letter/z/c57346/32.png) [@zhenghaihui](https://forum.ionicframework.com/u/zhenghaihui)\
**Post date:** [January 3, 2014, 7:17am UTC](https://forum.ionicframework.com/t/how-to-make-the-sccollbar-of-content-element-scroll-down-to-the-bottom-automatically/393/1 "2014-01-03T07:17:12Z")

</div>

@max , i have troubles in using ionic,i don’t know how to make the sccollbar of content element scroll down to the bottom automatically?

---

<div class="post-metadata">

**Author:** ![zhenghaihui](https://avatars.discourse-cdn.com/v4/letter/z/c57346/32.png) [@zhenghaihui](https://forum.ionicframework.com/u/zhenghaihui)\
**Post date:** [January 3, 2014, 9:19am UTC](https://forum.ionicframework.com/t/how-to-make-the-sccollbar-of-content-element-scroll-down-to-the-bottom-automatically/393/2 "2014-01-03T09:19:42Z")

</div>

T\_T anybody here???

---

<div class="post-metadata">

**Author:** ![SudoStack](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@SudoStack](https://forum.ionicframework.com/u/SudoStack)\
**Post date:** [March 8, 2014, 10:01pm UTC](https://forum.ionicframework.com/t/how-to-make-the-sccollbar-of-content-element-scroll-down-to-the-bottom-automatically/393/3 "2014-03-08T22:01:47Z")

</div>

Thanks to @maxlynch for the solution:

```
controller('MyCtrl', function($scope, $ionicScrollDelegate) {
  // When something happens
  $ionicScrollDelegate.scrollBottom();
});

```

For me, I just needed this to happen whenever somebody added a message to my chat:

HTML:

```
<input type="text" ng-model="msg.body" />

<button class="button button-clear button-positive" ng-click="send(msg.body)">Send</button>

```

JS:

```
.controller('chatController', function($scope, $ionicScrollDelegate, Chats) {
  $scope.send = function() {
    // Using my Chats service to do some async/persistence
    Chats.send( $scope.msg.body );
    // Make the chat window scroll to the bottom 
    $ionicScrollDelegate.scrollBottom();
  };
});
```

---

<div class="post-metadata">

**Author:** ![carchrae](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/carchrae/32/71680_2.png) [@carchrae](https://forum.ionicframework.com/u/carchrae)\
**Post date:** [December 15, 2014, 5:37pm UTC](https://forum.ionicframework.com/t/how-to-make-the-sccollbar-of-content-element-scroll-down-to-the-bottom-automatically/393/4 "2014-12-15T17:37:56Z")

</div>

Just a comment, you may want to use

```
$ionicScrollDelegate.scrollBottom(true);

```

If you’d like the scroll to be a smooth animation (rather than jump).

---

<div class="post-metadata">

**Author:** ![tailesh](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@tailesh](https://forum.ionicframework.com/u/tailesh)\
**Post date:** [January 20, 2015, 10:28am UTC](https://forum.ionicframework.com/t/how-to-make-the-sccollbar-of-content-element-scroll-down-to-the-bottom-automatically/393/5 "2015-01-20T10:28:44Z")

</div>

Delegate for handle “mainScroll” could not find a corresponding element with delegate-handle=“mainScroll”! scrollBottom() was not called!  
Possible cause: If you are calling scrollBottom() immediately, and your element with delegate-handle=“mainScroll” is a child of your controller, then your element may not be compiled yet. Put a $timeout around your call to scrollBottom() and try again.

Its not working

---

<div class="post-metadata">

**Author:** ![FMCorz](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/fmcorz/32/71994_2.png) [@FMCorz](https://forum.ionicframework.com/u/FMCorz)\
**Post date:** [June 8, 2015, 10:18am UTC](https://forum.ionicframework.com/t/how-to-make-the-sccollbar-of-content-element-scroll-down-to-the-bottom-automatically/393/6 "2015-06-08T10:18:23Z")

</div>

I’m looking at a solution that is better than:

```
    $timeout(function() {
        var scrollView = $ionicScrollDelegate.$getByHandle('yourHandle');
        scrollView.scrollBottom();
    }, 100);

```

Which works find on a browser, but if you happen to have an ng-repeat in your view, on a mobile device the scroll might happen before all the elements in the view are rendered. Hence not scrolling to the bottom. I’m looking for a solution but if anyone has one, please share ;-).

---

<div class="post-metadata">

**Author:** ![andre\_tarnowsky](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/andre_tarnowsky/32/87171_2.png) [@andre\_tarnowsky](https://forum.ionicframework.com/u/andre_tarnowsky)\
**Post date:** [June 30, 2015, 4:28pm UTC](https://forum.ionicframework.com/t/how-to-make-the-sccollbar-of-content-element-scroll-down-to-the-bottom-automatically/393/7 "2015-06-30T16:28:02Z")

</div>

define a watch statemant for the object that used with repeat:

```
  $scope.$watch('scopeNameOfTheElementThatRepeated', function(newValue, oldValue) {
    $ionicScrollDelegate.scrollBottom(false);
  }, true);

```

I recomend to disable animations in this case
