'NullInjectorError: No provider for NotifierQueueService! Karma Angualr 6
Am using angular-notifier in my application .It is working well with imports import { NotifierModule } from 'angular-notifier'; in app.module.ts
and in spec.ts of component i have added import { NotifierService } from 'angular-notifier';
providers: [NotifierService] in TestBed
NullInjectorError: No provider for NotifierService : This resolved with above import in spec.ts
After that am facing this issue : NullInjectorError: No provider for NotifierQueueService!
I didn't find any import on NotifierQueueService.
Please help me with this am struggling with 2 working days .Do we have any solution for this.
Solution 1:[1]
You should include NotifierModule into 'imports' section
import { NotifierService, NotifierModule } from 'angular-notifier';
// ...
TestBed.configureTestingModule({
imports: [NotifierModule]
// ...
Solution 2:[2]
This problem is usually a lack of service injection in providers.
Try add NotifierQueueService in providers inside TestBed.configureTestingModule
TestBed.configureTestingModule({
declarations: [],
providers: [NotifierQueueService] // Here
})
Solution 3:[3]
in service class after import section check whether below code is there
@Injectable({
providedIn: 'root'
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alexander Nied |
| Solution 2 | Walteann Costa |
| Solution 3 | nan |
