coolForNet
coolForNet

Reputation: 1

Call two web Rest web api one by one in angular js

I have two web api to sync data from local to server. my Data is in master / child form. My need is to once master data is synced then child data to be sent for syncing. I am very new in angular js. Kindly help me.

Upvotes: 0

Views: 216

Answers (1)

devqon
devqon

Reputation: 13997

First do the first request, and on the callback do the second:

$http.get("firstRequestUrl").then(function(data) {
    // success
    $http.get("secondRequestUrl?myVar=" + data.myVar).then(function(secondData) {
        // second request success
    }
}

Upvotes: 3

Related Questions