I have an angular 9 component which is used to upload data(images) to the server. I want to prevent the component from refreshing on routing. I want the upload to continue even on changing routes. How do I achieve this??
Most probably you want to implement the upload logic in a service (rather than component). Then you inject that service (which can be provided in parent component, or module, or even as singleton depending on your needs).
Then, your component tells the service to start the upload, and the upload will continue even if the user navigates away from the page and the component itself is destroyed.
Now, have in mind that this might be bad UX - if you see progress bar halfway there, and navigate away from the page you usually don't expect the upload to continue. Especially since that's what will happen if the user navigates outside of the SPA. But that's a different matter, and I'm no UX expert myself.