angular2-web-worker icon indicating copy to clipboard operation
angular2-web-worker copied to clipboard

Angular 6 : NullInjectorError: No provider for WebWorkerService!

Open yogeshpaisode opened this issue 6 years ago • 2 comments

Hi, I am getting the following error when using with Angular 6.

ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[AppComponent -> WebWorkerService]: StaticInjectorError(Platform: core)[AppComponent -> WebWorkerService]: NullInjectorError: No provider for WebWorkerService! Error: StaticInjectorError(AppModule)[AppComponent -> WebWorkerService]: StaticInjectorError(Platform: core)[AppComponent -> WebWorkerService]: NullInjectorError: No provider for WebWorkerService! at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:1062) at resolveToken (core.js:1300) at tryResolveToken (core.js:1244) at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1141) at resolveToken (core.js:1300) at tryResolveToken (core.js:1244) at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1141) at resolveNgModuleDep (core.js:8369) at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:9057) at resolveNgModuleDep (core.js:8369) at resolvePromise (zone.js:814) at resolvePromise (zone.js:771) at zone.js:873 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421) at Object.onInvokeTask (core.js:3811) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188) at drainMicroTaskQueue (zone.js:595)

yogeshpaisode avatar Jan 08 '19 07:01 yogeshpaisode

use this:

import {WebWorkerService} from 'angular2-web-worker/web-worker.service';

oriolmartin avatar Jan 28 '19 11:01 oriolmartin

@Component({
    selector: 'something',
    templateUrl: './something.component.html',
    providers: [WebWorkerService],
})

kevanslumin avatar Aug 29 '22 16:08 kevanslumin