How to use the Angular services in a Worker?

Viewed 357

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.

1 Answers

Short answer is that what your asking can't be done. You can not inject Angular service into an 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 in to 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 scope to do that. At least, that's my take on the matter.

Related