How to call/run method when view get completely Loaded


#1

I want to call method automatically when template get completely loaded?


#2

See:


#3

Thanks for the reply. But I have tried lifecycle events. All the lifecycle event execute before loading the template. I want to execute a method when template get completely loaded.


#4

Try setting a timeout:

  public ionViewDidLoad() {

    setTimeout(() => {

      ...

    }, 1500);
  
  }

#5

I strongly disagree with the setTimeout advice. Different devices do different things at different speeds under different conditions, making it impossible to come up with a proper magic number.

OP should back up and describe the actual fundamental issue, because trying to do what is specifically asked is extremely unlikely to be what is really wanted.


#6

Do you have any better way to do this?


#7

Not until you describe “this” in much broader terms.


#9

I want to retain polyline on maps even when user leave the current page (when side menu button is clicked). To redraw polyline on map, map should be loaded first then only we can pass location array. Hence I want to call method drawPolyline() when map get rendered and loaded on display.


#10

Assuming you’re talking about Google maps and using this plugin, perhaps that MAP_READY event would be useful.


#11

I use a MapsApiLoaderService.

See:


Display long and lat maps