Any way to force construction of a page on app start?


#1

I have a global modal that I would like to have constructed (but not opened) when my app starts. Is there any way to do this in Ionic 2?

Thanks.


#2

“Force” is one of those words that is a red flag for me. Whenever I feel myself wanting to force something, I try to take a step back and consider what I am really trying to achieve. I have found this to be helpful tenfold in web applications, where I am not in control of execution flow, and all of my attempts to “force” things tend to go badly.


#3

That’s probably a good rule of thumb, but in this case I don’t know if I have any way around it (been stuck on it for a bit). My situation:

My page consists of a series of songs. When I click a song, I want the song play to start in the background (the source can be audio or a music video). I use a modal to house the video player. Audio files play fine in the background, but video files wont play in the background because the modal is not constructed (and thus the video player is not constructed).

So my solution was to have the modal be constructed on app launch. A modal can be opened/constructed on app launch by calling the present() function, but that would be silly if there is no music playing. So now I am stuck because I want the modal to be constructed but not opened!

Thanks for reading/trying to help.