Getting progress event from $http (for file upload progress)

1,302 views
Skip to first unread message

xrd

unread,
Nov 6, 2012, 10:15:00 AM11/6/12
to ang...@googlegroups.com
I've been trying to implement a upload controller in AngularJS and not sure if I can hook into the "progress" events so I can display upload progress.

I see a bunch of code on the Interwebs which indicate with a raw XHR I can hook into a "progress" event (or perhaps this is normalized to the onprogress handler...).

Is there a way to do this with either $http or $resource?

I tried doing:

$scope.$on( 'progress', function() { console.log( "Got a progress event" ); } );

But, I don't see any indication this works.

I don't see documentation inside $http for this, nor in $resource.

I'm fine doing it by getting the raw XHR request, but I don't see a way to get this from $http either.

Any suggestions? 

Chris

Joe Grund

unread,
Nov 29, 2012, 1:23:25 PM11/29/12
to ang...@googlegroups.com
I am also looking at this issue. It appears that the XHR is closed off and is not injected into $httpBackend but rather instantiated before a request is made.

It would be great to be able to either pass a configuration of eventlisteners to apply to the XHR object or make the XHR a module that can be configured, decorated, etc...
Reply all
Reply to author
Forward
0 new messages