title: Angular 2 - Resolve Component Factory with a string
body: <p>This is for the 2.1.0 Final release versions of Angular.</p>
  
  <p>I'm trying to dynamically instantiate a component who's type is passed from a config JSON file. The best thing I can find is <code>ComponentFactoryResolver</code>, however all usages that I have found save one seem to be passing actual <code>Type</code> objects to the resolver.</p>
  
  <p>Is there a way to get the <code>Type</code> from a string? Because presently, passing the type as a string gives me the error:</p>
  
  <p><code>No component factory found for MyComponent</code></p>
  
  <p>Relevant code:</p>
  
  <p>StructureBuilder component:</p>
  
  <pre><code>private renderComponent(config:any) {
      let configComponents = config.components;
      if(config.hasOwnProperty('components') &amp;&amp; configComponents.length){
          for(let i = 0, len = configComponents.length; i &lt; len; i++){
              this.componentResolver.resolveComponentFactory(configComponents[i]);
          }
      }
  }
  </code></pre>
  
  <p>where config.components is an array of strings that use the <code>Type</code> as a value.</p>
  
  <p>And in the module definition (Structure.module.ts)</p>
  
  <pre><code>@NgModule({
      declarations: [
          MyComponent,
          StructureBuilder_Cmp
      ],
      entryComponents: [
          MyComponent
      ]
      //Etc...
  });
  </code></pre>
  
  <p>As far as can tell with the sparse docs, this is exactly how you're supposed to do it.</p>
  
  <p>If I change the dynamic string passed in from <code>configComponents[i]</code> to the actual imported type reference for <code>MyComponent</code>, it works.</p>
  
  <p>So basically, the question is:
  Is there a way to use <code>resolveComponentFactory</code> with strings to resolve a component, and if not, is there way to get a <code>Type</code> reference from a string value?</p>