My controller code
$scope.totalchatsdone = function (){
var i =0;
$.each(results.websites,function(index,website){
var id = website.id;
$scope.tech = techRepository.getTech.query({ id }, function(data) {
console.log("total--"+ data.total)
i += data.total;
});
});
console.log("i is--"+i)
return i;
};
my factory code
factory('techRepository', ['$resource', function ($resource,$http) {
return {
getTech: $resource(base_url+'/testapi/chats/:id', {id: '@id'}, {query: {method: 'GET'}})
};
}])
What I want: -
I want to get $ scope.totalchatsdone as an integer
Edit: - console pic-- I don't know why I am here 0, see the console, please (why doesn’t it accept the total cost?) ...

source
share