I would like to make facilitate the declaration of a provider by calling a static function like this :
const provider = MyModule.makeProvider();
@NgModule({
bootstrap: [AppComponent],
declarations: [AppComponent],
imports: [
...
],
providers: [
provider,
...
],
})
but it fails with AOT (the provider is missing)
Whereas this is working :
const providers = [{provide : myToken, useValue: "value"}];
@NgModule({
bootstrap: [AppComponent],
declarations: [AppComponent],
imports: [
...
],
providers: [
provider,
...
],
})