I am currently utilizing Smart Table and I would like to automatically navigate to a specific page once the controller has been created and the table is displayed.
After searching on stackoverflow, I came across this code snippet that allows me to achieve this programmatically here:
angular.element( $('#pagination') ).isolateScope().selectPage(pageNumber);
The HTML id of my Smart Table's pagination div is "pagination". I have found that I cannot call this function until the controller exits as the isolateScope method returns "undefined". Therefore, I decided to delay the call by a few milliseconds to ensure that the table/page has been fully created.
Interestingly, the selectPage function works perfectly when called from my custom pagination or a button at the bottom of the page. However, it fails to work if triggered by a timer. I have delved into the source code of Smart Table's selectPage() and pipe() functions but I cannot identify why one approach succeeds while the other does not.
You can test this behavior on this Plunker: Click one button to jump to Page 5 as expected, then click the other button to set a 3-second timer which should navigate to page 2, but nothing happens...