0

Tell me please, how to receive a list all classes, which was declared in @NgModule.

Which modules I have in @NgModule:

@NgModule({
  declarations: [MyApp, AuthPage, HomePage]
})

And example of I want to receive:

export class AppModule {
  constructor() {
    this.ngModule.declarations.getClasses() // should return something like: [[MyApp, AuthPage, HomePage]]
  }
}

How can I receive a list of declarations or providers?

Aref Zamani
  • 2,023
  • 2
  • 20
  • 40
Yegor
  • 1,088
  • 1
  • 10
  • 14
  • 1
    No it is not possible, why do you want to do that? – Sajeetharan Jan 07 '18 at 12:50
  • Oh. I need a method, which will return me a class instance by their string name. For example, I want to call a method with "MyApp" param and receive MyApp as a class. As a workaround, I can implement classes as AppModule properties, but I don't want to make class declarations twice, in NgModule and in AppModule. – Yegor Jan 08 '18 at 09:39

0 Answers0