How to get rid of the asynchronous problem. The http request will return the data number, and then use this number globally. However, due to asynchronous reasons, the assignment variable of this number is always undefined. How to deal with this
淡淡烟草味2017-05-24 11:35:22
I have encountered this before, but we are using an http service written by ourselves, which returns a promise object, so we have to use then to obtain the data inside. I looked at this method written by a colleague, and it seems that it returns the response.data of http in Angular. I don’t know if this will help you
滿天的星座2017-05-24 11:35:22
Put the logic code that will use the data into the callback function of the asynchronous request success to ensure that the data has been obtained when the code that needs to use the data is executed.