I know for sure that i'm doing some wrong in doing the imports or in the way doing the dependency injection.
I have LoginService class where i send the login parameters to the server. When i remove AuthHttp from imports, the login page is shown. but, the constructor argument injection failed since i have reference to authHttp parameter. But, when i add AuthHttp to the import as shown below, it throws the error
No Provider for AuthHttp
import {Injectable} from 'angular2/core';
import {IUser, User} from '../models';
import {AUTH_PROVIDERS,AuthHttp,JwtHelper} from 'angular2-jwt'
import {Appsettings} from '../app.settings'
@Injectable()
export class LoginService {
private _user : IUser = null;
private LOGIN_API_URL : string = "/users/login"
private jwtHelper : JwtHelper = new JwtHelper();
constructor(private authHttp : AuthHttp) {
}
ORIGINAL EXCEPTION: No provider for AuthHttp!
ORIGINAL STACKTRACE:
Error: DI Exception
at NoProviderError.BaseException [as constructor] (http://localhost:3000/vendor.bundle.js:1079:24)
at NoProviderError.AbstractProviderError [as constructor] (http://localhost:3000/vendor.bundle.js:9964:17)
I would like to know how to inject AuthHttp with my `AuthConfig object into my service implementations?
Have you looked through this? https://angular.io/docs/ts/latest/cookbook/dependency-injection.html#!#nested-dependencies