ng-webworker icon indicating copy to clipboard operation
ng-webworker copied to clipboard

Can not inject services

Open vpnocsen opened this issue 8 years ago • 4 comments

I want to call a service injected in directive ($compile for example) but i don't know how. I try to pass this service as an param but got the error with Post message 'An object could not be cloned"

vpnocsen avatar Aug 23 '16 18:08 vpnocsen

I also met this problem,and have you resolved it

guaputao avatar Dec 08 '16 01:12 guaputao

Can you post an example?

mattslocum avatar Jun 30 '17 03:06 mattslocum

@mattslocum I have same issue. so I wanna call the service in webworker but it's not working. check out the following example, please.

function setEvent(event) {
          console.log('event', event);
          EventService.set(event)
            .then(function (result) {
               return true;
            }).catch(function(error) {
               return error;
            });

var setEventWorker = Webworker.create(setEvent);

setEventWorker.run(event).then(function(result) {
    console.log('result', result);
});

EventService is the service I wanna use in the controller's webworker.

wiadev avatar Sep 13 '17 21:09 wiadev

@mattslocum I have same issue. so I wanna call the service in webworker but it's not working. check out the following example, please.

function setEvent(event) {
          console.log('event', event);
          EventService.set(event)
            .then(function (result) {
               return true;
            }).catch(function(error) {
               return error;
            });

var setEventWorker = Webworker.create(setEvent);

setEventWorker.run(event).then(function(result) {
    console.log('result', result);
});

EventService is the service I wanna use in the controller's webworker.

How do you slove this issue? I also have the same problem as yours. I have a angularjs $filter function, it can't be called in the webworker. It 'll show $filter is not define, but i don't know how to inject the $filter function to the webworker.

KinkiWu avatar Nov 11 '19 10:11 KinkiWu