I probably wasn’t very clear when I asked my question. I’m not talking about pages here, or not just about pages. What happens if you need to synchronize between providers?
Here is an example:
I have a provider that initializes connection to back-end server. I have a couple of other providers that retrieve data from this back-end server and do whatever modifications they need to do with this data. Up until now the DB connection string was kind of hard coded and it wasn’t a problem: since I inject the initialization provider into the others, the DB connection has been initialized before the real data retrieval.
Now I need to make this initialization string dynamic, for example read it from a
file. The function that reads from a file returns promise immediately and then the provider that retrieves data is trying to connect to the DB before the connection has been initialized, and fails. In this case, how can I make sure that the connection has been initialized before the actual data retrieval happens?
And no, I can’t put initialization and retrieval code in the same provider. I access many different objects in the DB and I need the initialization to be made only once. And I can’t put code that deals with different DB objects in one provider because it makes code messy and unreadable.
What am I missing? I don’t come from a web development/Angular background, so I really have a feeling that I’m missing something on the conceptual level.
Appreciate your help.