I am encountering an error message stating "has no exported member test" when trying to import test from ConfigAppProviderModule. Could there be a mistake in how I am writing the service with config in the module?
import { NgModule ,InjectionToken,Injectable } from '@angular/core';
export const ConfigToken = new InjectionToken<string>('ConfigToken');
class test {
config:any;
constructor(config){
this.config = config;
}
a(){
console.log("this.config",this.config);
}
}
const ConfigAppProvider = {
provide: test,
useFactory: (config) => {
return new test(config);
},
deps: [ ConfigToken]
};
@NgModule({
providers: [ ConfigAppProvider ],
})
export class ConfigAppProviderModule {
static initializeApp(config) {
return {
ngModule: ConfigAppProviderModule,
providers: [
{ provide: ConfigToken, useValue: config }
]
}
}
}