How to Wait for Multiple Promises for All Data Success Callbacks

前端 未结 3 807
迷失自我
迷失自我 2021-01-26 10:26

I have this API call, but I don\'t receive the data in my successCallback in the same order as I send it.

    for (var i = 0; i < data.length; i+         


        
3条回答
  •  萌比男神i
    2021-01-26 10:56

    $http.get('/someUrl', config).then(successCallback, errorCallback); $http.post('/someUrl', data, config).then(successCallback, errorCallback); you can try these note the The response object has these properties:

    data – {string|Object} – The response body transformed with the transform functions.
    status – {number} – HTTP status code of the response.
    headers – {function([headerName])} – Header getter function.
    config – {Object} – The configuration object that was used to generate the request.
    statusText – {string} – HTTP status text of the response.
    

    And these too can also work depending on the API you working on...

提交回复
热议问题