I'm having this piece of code written in javascript
preDefineListName = ['Applied', 'Test taken', 'SWS Interview', 'Candidate', 'Rejected'];
for (var i = 0; i < preDefineListName.length; i++) {
Trello.addList(data.id, preDefineListName[i]);
};
Trello.addList = function (trelloBoardId, listName) {
return $http.post('https://api.trello.com/1/lists', {
idBoard: trelloBoardId,
name: listName,
key: trelloKey,
token: trelloToken
});
};
now above function Trello.addList in the for loop makes a list on the trello.com with the given names in preDefineListName. The problem is the lists are not appearing in the order as they passed.
What should I do to make it in proper order. and i've to call function in the loop so I can't change it.
Trello.addList()method asynchronous? If so there's no way to guarantee the order the requests are returned in. You would need to hook an event to when all the requests are finished and then order the list.datavariable?