Jake Rote
Jake Rote

Reputation: 2247

On Page Loaded Event

Is there a way to run code when a view has been loaded as I would like to interact with an element when the page is loaded. I have tried putting the code in the constructor of the component but the view has not been loaded at that point

Upvotes: 1

Views: 105

Answers (1)

Pixel Elephant
Pixel Elephant

Reputation: 21383

In your routing configuration you can specify an enter handler that is called when the view is loaded:

'some_view': ngRoute(
    enter: (RouteEnterEvent e) => print('Entering view'))

You can find more information on routing events in the Angular Tutorial.

Upvotes: 1

Related Questions