Ionic Angular.js $http module can not get data


In Anguler js if I used two times $http in a single function so, will it affect the fetching of data from web services?

Like :-
.factory('Chats', function($http) {



Fetching data using two $http calls is not a problem and they will not interfere with each other because they are called asynchronously.

This is great because it means that they will both be called nearly immediately without one having to wait for the other to complete.

You should know, however, that because of this you could get the results of the second call before you get the results of the first call. This might happen if you were to have a very long call (large amount of data) in your first $http and a very short one (small amount of data). If you want to wait for both to be completed before proceeding then you can use $q.all to wait for both to complete before proceeding. You can read more about this here:

Answered By – JimTheDev

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published