I have this AngularJS code:
promise.then(function(data) {
$scope.data = data;
$scope.hasData = (data.length > 0);
// Do jQuery code here
},
As you can see, a promise has been fulfilled (some API data has finished downloading). Only once this data finishes downloading, I want to run some jQuery (I want the page to automatically start scrolling to the bottom over say 60 seconds).
How can I nicely do this? I understand it's not good practice to include jQuery code in the middle of AngularJS code (maybe something about the dollar signs being used by both?) but I'm not sure how to get around it.
Any advice appreciated, thank you.
EDIT:
This is the jQuery code I'll use:
// Scroll up, then scroll down
var intervalTime = 60000;
$('html, body').animate({ scrollTop : 0}, 800);
$("html, body").animate({ scrollTop: $('html, body').get(0).scrollHeight }, { duration: (0.75 * intervalTime) });