Listen to page show function


#1

I want to run a function after view is ready and visible (not init).
How can i do this?

In jquerymobile would be something like ‘onpageshow’.
Thanks.


#2

You can just run the code in your controller, and it will get executed when ever that controller is called.

  $timeout(function(){
    alert("paged Loaded");
  })

#3

Thanks mhartington, but my purpose is run some code after destination page is completely open to user.

With your code, the alert shows up even before the destination page opened.
I solved it by adding millisecond paramater:

$timeout(function() {
alert(“paged Loaded”);
}, 2000);

But I think it’s not safer if just based on time.


#4