this autogenerated service (by NSwagStudio) needs an API_BASE_URL (InjectionToken) value in order to perform http requests how and where i can inject it?
/*
On the parent module create a provider for API_BASE_URL
export function getBaseUrl(): string {
return AppConsts.baseUrl;
}
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule],
providers: [{ provide: API_BASE_URL, useFactory: getBaseUrl }],
bootstrap: [AppComponent]
})
export class AppModule {}
and then define a AppConsts class with static properties as such
export class AppConsts {
static baseUrl = "your_api_base_url";
}
Worked for me, hope it help. This solution is based on aspnet boilerpate angular project, which for me give the best standards on architecture. I leave you here the url for the angular project + the url for this specific code.