How to Get the List of services and directives available to the current component
<p>For a component <code>MyDemoComponent</code> </p>

<pre><code>@Component({
   selector : 'my-demo-component',
   template : '&lt;div&gt; Demo &lt;/div&gt;'
})
class MyDemoComponent { };
</code></pre>

<p>Which has been included in <code>MyDemoModule</code> </p>

<pre><code>@NgModule({
  imports : [SomeOtherModule],
  declarations: [AnotherComponent, SomeOtherComponent],
  export : [MyDemoComponent]
})
class MyDemoModule { }
</code></pre>

<p>Now is there any way I can get a list of all the components , services and pipes that <code>MyDemoModule</code> makes available to <code>MyDemoComponent</code>. </p>

<p>From <a href="http://blog.lacolaco.net/post/dynamic-component-creation-in-angular-2-rc-5/" rel="nofollow noreferrer">what I have looked</a> up so far I can use <code>ViewContainerRef.parentInjector</code> which is a (sort) of collection of services I was looking for. However I am still at a loss as to how to get the list of directives and pipes that are used in <code>MyDemoComponent</code> .</p>

<p>I am basically trying to create a component that can dynamically create other components, similar to <a href="https://stackoverflow.com/questions/36325212/angular-2-dynamic-tabs-with-user-click-chosen-components/36325468">this question</a>. However In the views of the dynamically created components I want to use the components,services and pipes registered in the parent module.</p>

<p>EDIT : Here I am posting the relevant section of code where the list I mentioned will help me :</p>

<pre><code>export class DynamicComponentCreator {
  @Input() html: string;

  constructor(private vcRef: ViewContainerRef, private compiler: Compiler) {}

  ngOnChanges() {
    const html = this.html;
    if (!html) return;

    @Component({
      selector: 'dynamic-comp',
      template: html
    })
    class DynamicHtmlComponent  { };

    @NgModule({
      imports: [CommonModule],
      declarations: [DynamicHtmlComponent]
    })
    class DynamicHtmlModule {}

    this.compiler.compileModuleAndAllComponentsAsync(DynamicHtmlModule)
      .then(factory =&gt; {
        const compFactory = factory.componentFactories
               .find(x =&gt; x.componentType === DynamicHtmlComponent);
        const cmpRef = this.vcRef.createComponent(compFactory, 0);
    });
  }
}
</code></pre>

<p>As you can see the module I'm creating inside cannot be configured to use the services/components/pipes available to parent module. This code is slightly modified from what is seen in <a href="https://stackoverflow.com/questions/39410355/how-to-use-variable-to-define-templateurl-in-angular2#answer-39411464">this question</a></p>