I have a simple template as following :
<ul ng-repeat="email in emails">
<br>Email ID {{email.EmailsID}} <br>
Unread {{email.Unread}}
<ul>
The issue is that I need to fetch the data in two calls: The list of EmailsID from an API and the Unread value of each EmailsID from another API. Any idea how to make this work ? I've tried something below and I can fetch the the EmailsID but I don't know how to merge it with the unread value of each emailsId from the syncAPI. Currently I've hardcoded the emailsId value to 9 in the API URL as can be seen below http://local.app.com:8080/imap/syncAPI?emailsId=9
var crmApp = angular.module('crmApp', []);
crmApp.controller('EmailsCtrl', function($scope, $http) {
$http.get('http://local.app.com:8080/emailsAPI', {withCredentials: true}).success(function(data) {
var index;
for (index = 0; index < data.length; ++index) {
$http.get('http://local.app.com:8080/messages/imap/syncAPI?emailsId='+data.EmailsID+'&mailbox=inbox', {withCredentials: true}).success(function(unreadD) {
data[index].unread = unreadD;
$scope.emails = data;
});
});
I'm new to angularjs and javascript
ng-repeatiteration?