I have started recently the migration of an AngularJS application to Angular 4 using the upgrade module.
One of my AngularJS directives uses a third party library (ngFlow) to upload files using XMLHttpRequest.send()
. When running in hybrid mode, uploads work fine both, in Chrome and in Firefox. However, in Safari the app becomes very slow during an upload and the browser process reaches 100% CPU used.
Using Safari web tools, I see that there is a lot of calls to globalZoneAwareCallback
from zone.js.
My impression is that the Angular zone is kicking off change detection for every XMLHttpRequest
progress event happening during the upload.
I am aware that I could use runOutsideAngular
from NgZone
to avoid this, but I don't know how to use it in the case where the async call is happening in a third party AngularJS library or if there is any other solution to address this issue.