I have a web worker created in which I want to use the current functions that are placed in an Angular Service. Tried passing them through the postMessage but that doesn't work.
Short answer is that what you're asking can't be done. You cannot inject an Angular service into a worker. For background data, PWA actions, caching, calculations, and all that is doable, but not service injection. Think of a worker as a script built into the browser that wraps around your DOM, and Angular as a wrapper for javascript code that runs in the DOM. It's just not in Angular's scope to do that. At least, that's my take on the matter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With