Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70435

TestBed for HttpInterceptor shows NullInjectorError: No provider for Events

$
0
0

@srjovanovic wrote:

I’ve created HttpInterceptor, and I’m using Events in constructor as shown. I’ve wrote TestBed for it, but when I start Karma, it shows an error:
Error: StaticInjectorError[Events]:
StaticInjectorError[Events]:
NullInjectorError: No provider for Events!
How can I provide Events in TestBed?

// My HttpInterceptor
import {HttpEvent, HttpHandler, HttpInterceptor, HttpRequest} from “@angular/common/http”;
import {Injectable} from “@angular/core”;
import {Events} from “ionic-angular”;
import {Observable} from “rxjs/Observable”;

@Injectable()
export class APIAuthInterceptorProvider implements HttpInterceptor {
private userProfileDetails;
private clubProfileDetails;

constructor(private connectionEvent: Events) {
}

. . .

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70435

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>