One of the challenges I am facing in my Angular5 application is related to a module that I am using in the following way:
import *....
@NgModule({
providers: [
AuthentificationService,
{
provide: AuthHttp,
useFactory: AuthentificationService.MYMETHOD,
deps: [Http, RequestOptions, EnvVarsService, LocalStorageService, RouteNavigator, ReloadTokenEventService]
}
]
})
export class AuthModule {
constructor( ) {}
}
The issue lies in utilizing a custom method named MYMETHOD which is defined in my AuthentificationService
This is how my service looks like:
@Injectable()
export class AuthentificationService {
constructor() {}
public authHttpServiceFactory(http: Http, options: RequestOptions,
envVarsService: EnvVarsService,
localStorageService: LocalStorageService,
router: RouteNavigator,
reloadTokenEventService: ReloadTokenEventService) {
return new AuthHttp(new AuthConfig({
tokenName: 'X-Auth-Token',
headerName: 'X-Auth-Token',
noTokenScheme: true,
noJwtError: true,
tokenGetter: (() => this.getAccessToken(http, options, envVarsService, localStorageService, router, reloadTokenEventService)),
globalHeaders: [{'Content-Type': 'application/json'}],
}), http, options);
}
private getAccessToken(): Promise<string> {
// SOME TREATMENT
}
}
}
However, it appears that I am unable to locate (AuthentificationService.MYMETHOD)
Any suggestions on how to tackle this?