javascript - Loading directives sequentially -


i have html view full of angular directives. problem each directive performs lot of http requests. causing heavy load on cpu usage. our idea load 1 directive @ time i.e. 1 directive initializes controller (and therefore performs calls), next 1 starts.

edit: directives in different dom elements i.e. can't use priorities or prelinks, etc..

do think possible? thanks.

in opinion can have widgetrequestservice, can used widget make http request. directive can make request like:

widgetrequestservice.makecall(url, priority, function() {/*success call back*/}, function () {/*failcallback*/}) 

and in service can have queue (you can sort based on priority after every call) , method:

makecall: function (url, priority, successcallback, failcallback) {     //add url queue }   processcall: function() {//to process url} 

this way widget provide priority set user.


Comments