Hello,
Thank you!!
I have 4 different controller on my page. Here is one such controller.
.controller('virtualData',['$scope','newdataLoad','$timeout',function($scope,
newdataLoad, $timeout){
"use strict";
$scope.loadData = function () {
var dataResult=[];
var fleetOnline=
angular.element('#virtual_plant').data('service');
dataResult.push(fleetOnline);
newdataLoad.getData(dataResult).then(function(data){
var fleetDataPrint= Math.round(((Math.random() * 20) + 1));
$("#virtual_plant .gauge-circle
span:first-child").text(fleetDataPrint);
angular.element('#virtual_plant').attr('input',fleetDataPrint);
newdataLoad.buildGuage(fleetDataPrint,'virtual_plant');
});
dataResult.pop();
};
$timeout(function(){
$scope.loadData();
});
var virtualVar=setInterval(function() {
$scope.loadData();
},10000);
$scope.$on("$destroy", function(){console.log('out if it');
clearInterval(virtualVar);
});
}]);
And offcourse the service
this.getData=function(files){
var promises = [];
angular.forEach(files, function(file){
var deffered = $q.defer();
$http({
url : file,
method: 'GET'
}).
success(function(data){
deffered.resolve(data);
}).
error(function(error){
deffered.reject();
});
promises.push(deffered.promise);
});
return $q.all(promises);
};
I dont have controller over the controller hitting the service. There might
be 2 controller or say 8 controllers, its all from configuration file. In
jquery we have ajaxComplete, like wise do we have something in Angularjs:)
Regards,
Madhu
On Tuesday, June 10, 2014 3:41:54 PM UTC+2, Thomas Murphy wrote:
>
> Hi Madhu,
>
> Welcome to Angular! The direct analogue to what you're looking for is
> probably the all() method of $q. It's the last methods in the docs page
> here: https://docs.angularjs.org/api/ng/service/$q
>
> Best,
> Thomas
>
>
> On Tue, Jun 10, 2014 at 9:37 AM, madhu sudhan <[email protected]
> <javascript:>> wrote:
>
>> I have started some work on Angularjs. In jquery we have ajaxComplete, to
>> know if all the ajax request's are completed, in same way do we have
>> anything in Angularjs.
>>
>> I have multiple controllers talking to serive, I need to know once the
>> Asyn request from all the controllers are completed. I did read about
>> $http, $q and $http.interceptors, nothing that I understood.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "AngularJS" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/angular.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.