Reputation: 117
In the main controller I wrote:
angular.element(window).load(function () {
$timeout(function () {
scrollAnchor(); // Scroll to Anchor
});
});
I'd this to to scroll to the last operation right after all elements were rendered. The problem is that there are also other $timeout()
with other functions. So the scrolling is not the last operation. Is there a way to introduce a priority over the functions executed in $timeout
?
Upvotes: 1
Views: 613
Reputation: 22099
When you don't supply a delay parameter, the function is called on the next digest cycle.
So, to make sure that certain delayed executions are performed after others with the same parameters, just set a higher delay.
$timeout(scrollAnchor, 500);
Or you could fire an event when you know that "everything else" is done and then scroll to where you want to scroll.
Upvotes: 2