I started an Angular2 app and I have an issue since days !
Can\'t resolve all parameters for HomeComponent: (?).(…)
But my issue is not a
My problem ended up being nothing. I simply restarted the webpack watcher and then everything was fine. For reference, I'm using the Angular CLI.
The issue that raised this error for me was completely different. I had a logging category in the component that I had mistakenly used in the service, and thus the service had a dependency on the component and wasn't able to be created in time for it to be injected into the component.
TL;DR: Check the imports on the service that can't be injected.
Import this
import {Inject} from '@angular/core';
And change your constructor to
constructor(@Inject(AuthService) _authService: AuthService)
{
}
you should @Inject any service into constructor before using it.
and your service should be injectable
@Injectable()
export class AuthService {
}
Make sure you have
"emitDecoratorMetadata": true,
in your tsconfig.js
. You should not need to add @Inject()
to your function parameters if that's enabled.