In my application I am using AngularJS and nodeJS for rest api and its working fine. But when I try to call api using for loop its having some problems. Actually only last set of Parameters are passing to the api.
It means if I pass different parameters using loop 3 times then only last set of parameters passing to the api 3 times. First and Second are not send to api. Can anybody have any Idea??
Here is a sample code I use in Angularjs Factory.
var firstTimeData = {
"firstid": serializedJsonData.firstid,
"secondid": serializedJsonData.secondid,
"otherid": serializedJsonData.otherid
}
for (var i = 0; i < data[0].length; i++) {
for (var j = 0; j <= 2; j++) {
firstTimeData.dshdetailid = data[i][j].dshdetailid;
if ((data[i][j].defaultTitle).trim() == 'Scorecard Graph') {
BlankApi.getData(firstTimeData, 'slide' + j, 'periodname', 'amount');
}
}
}