`export function getApiKey(config: WebConfigService): Promise<boolean> {
return new Promise((resolve, reject) => {
config.getConfigLoaded().subscribe(key => {
if (key) {
apikey = config.getString('properties', 'apikey');
resolve(true);
} else {
reject(new Error('API Key not found'));
}
});
});
I want to get the key resolved and then call the forroot so that
This code needs some work as the forroot comes undefined
should have correct key`
I see, it seems like there might be a misunderstanding. In Angular, it’s not a recommended practice to directly access instance members from static methods because static methods are associated with the class itself, not with instances of the class. However, you can still achieve your goal by following a different approach.
imports: [
// FwBuilderModule.forRoot(apikey), this imports should be passed correct key
static forRoot(apiKey: string):ModuleWithProviders<FwBuilderModule>{
@NgModule({
imports: [
CommonModule,
CerillionBuilderBridgeComponent,
BuilderModule.forRoot(apiKey)
sumit mali is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.