I have project on the Angular 6. Some of my services extend base classes. Base classes are regular TypeScript classes without the @Injectable
decorator. When I try to run the app I'm getting the error:
NullInjectorError: No provider for HttpCommonService!
Wild guess - maybe it related to the DI somehow (since I extend some components from the another base classes without the @Component
decorator and it works perfectly), but, even in the DI case, I'm not creating the new base class instance apart from the extended service class.
What is the problem or, at least, where should I search for the problem?
Examples
This is the base class:
export class HttpCommonService {
constructor(protected http: HttpClient) {}
/* Methods here */
}
This is the service that injected to the app root
@Injectable({ providedIn: 'root' })
export class HttpService extends HttpCommonService {
constructor(protected http: HttpClient) {
super(http);
}
/* Methods here */
}