How to call/run method when view get completely Loaded

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

See:

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.

Try setting a timeout:

  public ionViewDidLoad() {

    setTimeout(() => {

      ...

    }, 1500);
  
  }

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.

1 Like

Do you have any better way to do this?

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

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.

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

I use a MapsApiLoaderService.

See: