Recently, as I've been making the switch to Angular 5, I encountered an error with my ApiService that I can't seem to resolve: can't resolve all parameters for ApiService(?)
Oddly enough, this issue only started cropping up after I introduced some new components, none of which actually interact with the service in question. Prior to this, everything was working smoothly with ApiService. Here's a snippet of what my ApiService code looks like:
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
...
@Injectable()
export class ApiService {
constructor(private http: HttpClient)
}
...
I made sure 'emitDecoratorMetadata' is set to true in my tsconfig.json file. Additionally, I have ApiService configured properly as a provider and imported in my app.module.ts file.
Strangely enough, when I added both @Injectable and @Inject decorators, the compilation went through without errors (I did this as a troubleshooting step, although it shouldn't be necessary).
Could there be another configuration setting I'm overlooking? Despite following advice mentioning the inclusion of @Injectable(), emitDecoratorMetadata, or adding the service to the providers array in app.module.ts – all steps that I've taken – ApiService ceased functioning correctly once new components were introduced.
I'm using webpack-dev-server for hosting my application. Interestingly, if I run 'ng serve', everything works fine, indicating a potential misconfiguration with webpack-dev-server. Is there a possibility of a recent update necessitating adjustments to my configurations?
Any tips or guidance would be greatly appreciated!