I’m building a chat application & I’d like the ion-list to scroll to the last ion-item when the view is loaded. I have attempted using $ionicScrollDelegate.scrollBottom()
within my ChatCtrl to no avail.
How would I achieve this otherwise?
I’m building a chat application & I’d like the ion-list to scroll to the last ion-item when the view is loaded. I have attempted using $ionicScrollDelegate.scrollBottom()
within my ChatCtrl to no avail.
How would I achieve this otherwise?
Sorry for the “me too”, but I’m experiencing this same issue. I’m interested to know what the ideal solution is. Thanks for posting the question.
Hey I found an easy solution, do the $ionicScrollDelegate.scrollBottom()
in a setTimeout
or $timeout
.
I’m using 10ms and it is working for me on Ripple emulator and my Galaxy S2 on Android 4.4.2 -
.controller('AddComment', function($scope, $state, $ionicScrollDelegate) {
setTimeout(function() {
$ionicScrollDelegate.scrollBottom();
}, 10);
})
I believe the problem is that when the controller has loaded, the child <ion-content>
has not loaded yet. Therefore, $ionicScrollDelegate won’t work until a timeout.
Fixes:
ion-content
$timeout
service)With $timeout service, $ionicScrollDelegate doesnt seems to work. I am using latest ionic version 1.3