A
A
Andrew2018-07-31 23:55:59
JavaScript
Andrew, 2018-07-31 23:55:59

How to stop execution of functions before receiving data?

There is some common service that stores a list of cars (for example, ["VAZ", "Volga", "Moskvich"]) and the car selected by the user - the first one by default. The list is obtained from the server.
There are a number of components and services that use the active car, for example, get brand data from the server.
The problem is that the components start running faster than the list of cars loads and try to get data for undefined.
How to correctly implement download waiting?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question