How to run http call as background in ionic Framework?


#1

I am using ionic Framework. i have multiple HTTP service which is working fine. Now problem is that whenever i get response of any http call. i can’t proceed further.

Can we run HTTP Service as a background process. So my application continues works without waiting for result.

here is my code

articleService.getArticles().then(function() {

    },function(err){

    });

and sercvice code

$http({
                url: "http://myservice.com",
                data: { user_id: 1 },
                method: 'POST',
                withCredentials: true,
            }).success(function (data) {
                deferred.resolve(data);
            }).error(function (err) {
             deferred.resolve(0);
            })
            return deferred.promise;
        }

Any idea? I need a solution in ionic framework which will work both for ios and andriod?