lundi 7 novembre 2016

Angular2: Get access to entryComponents property of Module inside a Component

In my Angular2 module I've specified an array of components in the entryComponents property like this:

  @NgModule({
   // ...
    entryComponents: [ComponentA, ComponentB]
   // ...
  })
  export class AppModule { }

In a component I want to access this list of entryComponents. Something like this:

import { Component } from '@angular/core';


@Component({
  selector: 'my-selector',
  // ...
})
export class MyComponent{

  // Something like this:
  constructor(private moduleRef: ModuleRef){
    console.log(moduleRef.entryComponents);
  }
}

Is this possible in any way? I do not need an explicit reference to the module itself but only on the entryComponents list.

Thanks for your help!




Aucun commentaire:

Enregistrer un commentaire