title: Angular 2 Cannot read property 'prototype' of undefined
body: <p>I have following code:</p>
  
  <p>wall.module.ts</p>
  
  <pre><code>import {CommunityComponent}                from './components/community.component';
  import {KayooModule}                       from './../kayoo/kayoo.module';
  import {PostModule}                        from './../post/post.module';
  import {NgModule}                          from '@angular/core';
  import {WallComponent}                     from './components/wall.component';
  
  @NgModule(
       {
           declarations:[ WallComponent,
                          CommunityComponent
                        ],
           imports:[PostModule],
           entryComponents: [CommunityComponent],
           providers:[ComponentFactoryService],
           exports:[WallComponent]
       }
  )
  export class WallModule {}
  </code></pre>
  
  <p>community.component.ts:</p>
  
  <pre><code>import { Component, Input, ViewContainerRef, ViewChild } from "@angular/core";
  import { Base } from './../../kayoo/components/base';
  
  @Component({
              selector    : 'community',
              templateUrl : 'app/templates/community.component.html',
              styleUrls   : ['app/templates/css/community.component.css'],
             })
  
  export class CommunityComponent extends Base
  {
  
       constructor()
       {
         super();
       }
  
       public result=(data:any)=&gt;
       {
         this.community=data;
       }
  } 
  </code></pre>
  
  <p>wall.component.ts:</p>
  
  <pre><code>import { CommunityComponent } from './community.component';
  import { ComponentFactoryService } from './../../services/services/component.fac';
  import { Component, Input,ViewChild,ViewContainerRef} from "@angular/core";
  
  @Component({
              selector:'wall',
              templateUrl:'app/templates/wall.component.html',
              styleUrls:['app/templates/css/wall.component.css']
             })
  
  export class WallComponent 
  {                        
    @ViewChild('wallContent', {read: ViewContainerRef}) containerRef: ViewContainerRef;
  
  
     private com:{[id:string]:any;} =
     {
       "loadCommunity"       : CommunityComponent
     };
  
     private    parameters : any;
  
     constructor(private factory:ComponentFactoryService)
     {
  
     }
  
  }
  </code></pre>
  
  <p>Base.ts:</p>
  
  <pre><code>import {Input,OnChanges,OnInit,ComponentRef} from "@angular/core";
  
  export class Base 
  {
  
    @Input() parameters : any;
    @Input() ref        : ComponentRef&lt;any&gt;;
    @Input() cfunc      : any;
  
  
    getParameters() : any
    {
      return this.parameters;
    }
  
    getRef() : ComponentRef&lt;any&gt;
    {
      return this.ref;
    }
  
    getCFunc() : any
    {
      return this.cfunc;
    }
  
  } 
  </code></pre>
  
  <p>core.module.ts</p>
  
  <pre><code>import { AsideModule }                 from '../../flayer/aside/aside.module';
  import { FooterModule }                from '../../flayer/footer/footer.module';
  import { NavigationModule }            from '../../flayer/navigation/navigation.module';
  import { HeaderModule }                from '../../flayer/header/header.module';
  import { WallModule}                   from '../../flayer/wall/wall.module';
  import { ServicesModule }              from '../../flayer/services/services.module';
  import { CoreService }                 from '../../core/services/core.service';
  import { NgModule }                    from '@angular/core';
  import { BrowserModule }               from '@angular/platform-browser';
  import { HttpModule}                   from '@angular/http';
  import { CoreComponent }              from './components/core.component';
  
  
  @NgModule({
    imports: [
      BrowserModule,
      HttpModule,
      HeaderModule,
      NavigationModule,
      WallModule,
      FooterModule,
      AsideModule,
      ServicesModule
    ],
    declarations: [CoreComponent],
    entryComponents:[],
    providers:    [CoreService],
    bootstrap:    [CoreComponent],
    exports:      [CoreComponent]
  
  })
  export class CoreModule { }
  </code></pre>
  
  <p>I have the class Base <strong>that is not a component</strong> and belongs to CoreModule and is the base class of a component class, in this case, CommunityComponent. I want to create CommunityComponent dynamically with:</p>
  
  <pre><code>  let factory  = this.componentFactoryResolver.resolveComponentFactory(component); 
        let injector = ReflectiveInjector.fromResolvedProviders([], refDOM.parentInjector);
        let comp     = factory.create(injector);
        (&lt;Base&gt;comp.instance).parameters=parameters;
        (&lt;Base&gt;comp.instance).ref=comp;
        (&lt;Base&gt;comp.instance).cfunc=cfunc;
        comp.changeDetectorRef.detectChanges();
  </code></pre>
  
  <p>The declaration of a dict in component WallComponent:</p>
  
  <pre><code>   private com:{[id:string]:any;} =
     {
       "loadCommunity"       : CommunityComponent
     };
  </code></pre>
  
  <p>Produces following error when I try to run the application:</p>
  
  <p><a href="https://i.stack.imgur.com/PST2n.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PST2n.png" alt="enter image description here"></a></p>
  
  <p>When I remove the <strong>"extends Base"</strong> from CommunityComponent the application works correctly. I need the component to inherit from Base and be able to get the type of the component in the mentioned dictionary.</p>
  
  <p>Is it possible to achieve this?</p>
  
  <p>Thank you.</p>