Hi,
I think having $q.defer.notify available in the $http interceptors would be
a very nice and powerful feature[1].
When you call $http({ }), you have a promise, but the notify ability isn't
available in the interceptor chain cause the original defer object has not
been added to it.
One approach with current angular version is decorating the $http provider,
and add the `notify` function to the config object, as I wrote in this plnkr
http://plnkr.co/edit/aTjGtk5L8oGT6Kd7rAf4
Other approaches may be:
* adding a second parameter to the interceptor chain callbacks
* Wrap entirely your custom services with the above plnkr approach if you
want this
* Add a reference to the parent defer object to every promise (not sure
Promises/A+ compatible)
Do you know guys why the angular team didn't add this feature from scratch?
Can you think of any other approach?
Regards,
Javier
[1] Having this could lead us to to make *generic* interceptors (ex: retry
request interceptor) that don't use $scope events to communicate the
progress of the request.
--
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.