Hi,

Is it possible in AngularJS to wait before a specific request is done?

I'm executing a $http.get() in the run() block of my authentication module 
to retrieve an access token. After I receive this token, I set the 
restangular default headers so that future requests can use it

Since the run() doesn't wait for the response, it can be that my index page 
is already requesting data without providing the token.

I want to avoid adding checks in every route or service call, so I was 
curious if I can block other $http requests until the token one is done.

On the IRC channel they referred me to http interceptors, but I'm not sure 
how to use them in this case to achieve what I want. (I already use it to 
handle 401 errors, but I don't see how I can block other requests with it).

Thanks in advance,

Dries

-- 
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.

Reply via email to