First, sorry for my bad english and second, if I use wrong terms. I am completly new to ionic and programming with angular or web things. I test with ionic 3.x.
I have a inputpage with various parts for input and so on. Normally I would call it each time, I need it. Sometimes it is needed often again and again. But make the inputpage ready needs a lot of time to setup, load or initialise. Once the inputpage is ready it works quick.
What is the best way to make this page available over the complete app, but make this page ready only at startup.
For example: A page have some elements with (click). At click the inputpage pops up like a overlay. Input is made. Close Inputpage and element gets the input. Same for the other elements with click. User change page that also has some elements with (click) and do it again.
Thanks in advance, but please remember I am completly new to ionic, angular an web things.
Sounds like you are describing a Modal.
Thanks for the reply.
Yes, in the moment it is in a modal. Each time I open the modal the heavy lifting of loading datas etc. is done and needs too much time. Once it is loaded it works fast enough. So I’m looking for a way to make this heavy loading etc. only at app start.
Maybe I don’t see it, but at the moment my knowlege is that with modal.create(modalpage) the modalpage is every time new createted and with diddismiss each time destroyed.
Today I made for other purpose a shared provider, but this is, so far I know, only for classes of code and not for pages. Is that right?
Best regards, anna
Your provider can have a method
NameOfProvider.ShowInputPageModal(), and a page could call that instead of calling a modal directly. Then the provider calls the modal, and knows to wait until everything is initialized.
Also, you don’t need to initialize at Startup. You could initialize the first time the modal is used, for example, so your app starts faster. Put the initialization where it has least effect on user experience.
Thanks Aaaron for the fast reply.
Maybe I have a wrong knowledge. If I put the create methode of the modal in NameOfProvider.ShowInputPageModal() then each time I call .create(myModalpage) every thing in constructor or ionviewdidload of myModalpage is done again and again each time I call .create(myModalpage).
Modal have, as far I known, nothing like var m = new modal(myModalpage) and myModalpage.show and myModalpage.hide.
Maybe I must split this, if possible, but then it isn’t capsuled (is this the correct term?)
Best regards, anna