<p dir="auto"><strong>Issues</strong></p>
<p dir="auto"><strong>Other Links</strong></p>
<ul dir="auto">
<li><a href="https://daveceddia.com/angular-2-errors/" rel="nofollow">https://daveceddia.com/angular-2-errors/</a></li>
<li><a href="http://www.bennadel.com/blog/3040-i-have-a-fundamental-misunderstanding-of-change-detection-in-angular-2-beta-8.htm" rel="nofollow">http://www.bennadel.com/blog/3040-i-have-a-fundamental-misunderstanding-of-change-detection-in-angular-2-beta-8.htm</a></li>
</ul>
<p dir="auto"><strong>I'm submitting a ...</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[x] bug report =&gt; search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request =&gt; Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question"><pre class="notranslate"><code class="notranslate">[x] bug report =&gt; search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request =&gt; Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
</code></pre></div>
<p dir="auto"><strong>Current behavior</strong><br>
<a href="http://stackoverflow.com/questions/42398059/angular-2-testmodulemetadata-does-not-have-an-entrycomponents-property" rel="nofollow">Here is my question on StackOverflow</a>.</p>
<p dir="auto">When using <code class="notranslate">TestBed.createTestingModule(&lt;TemplateModuleMetadata&gt;)</code> in my unit tests to test a service which dynamically creates and injects a component into the DOM, I am getting an error in the output of <code class="notranslate">ng test</code> as follows:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" Error: No component factory found for TestDialogComponent. Did you add it to @NgModule.entryComponents?"><pre class="notranslate"><code class="notranslate"> Error: No component factory found for TestDialogComponent. Did you add it to @NgModule.entryComponents?
</code></pre></div>
<ol dir="auto">
<li><code class="notranslate">No Component factory found for TestDialogComponent</code> and</li>
<li><code class="notranslate">Did you add it to @NgModule.entryComponents</code></li>
</ol>
<p dir="auto">The 2nd point is the problem. I cannot add the <code class="notranslate">TestDialogComponent</code> to the Testing module, because <code class="notranslate">entryComponents</code> does not exist on the <code class="notranslate">TemplateModuleMetadata</code> object.</p>
<p dir="auto">This is the following code in <code class="notranslate">test_bed.d.ts</code>, which shows that <code class="notranslate">entryComponents</code> does not exist in that type definition:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/**
 * @experimental
 */
export declare type TestModuleMetadata = {
    providers?: any[];
    declarations?: any[];
    imports?: any[];
    schemas?: Array&lt;SchemaMetadata | any[]&gt;;
};"><pre class="notranslate"><code class="notranslate">/**
 * @experimental
 */
export declare type TestModuleMetadata = {
    providers?: any[];
    declarations?: any[];
    imports?: any[];
    schemas?: Array&lt;SchemaMetadata | any[]&gt;;
};
</code></pre></div>
<p dir="auto">I have added the component to the <code class="notranslate">entryComponents</code> and <code class="notranslate">declarations</code> sections of the service's parent <code class="notranslate">dialog.module.ts</code>, but the tests still fail because the component hasn't actually been added to the testing module.</p>
<p dir="auto"><strong>Expected behavior</strong><br>
The <code class="notranslate">entryComponents</code> property should be defined in the <code class="notranslate">TestModuleMetadata</code> definition. I could be wrong, but I assumed that all properties that are available in the standard angular 2 NgModule should also be available for use in the <code class="notranslate">TestModuleMetadata</code> object, so that testing modules mimic the structure of the actual application as accurately as possible. If one of my application modules relies on the ability to dynamically inject components, shouldn't I be able to replicate that functionality in my test module?</p>
<p dir="auto">**Regarding my <a href="http://stackoverflow.com/questions/42398059/angular-2-testmodulemetadata-does-not-have-an-entrycomponents-property" rel="nofollow">StackOverflow question</a>, ** I've had a recommendation to simply add the Component I'd like to add to the <code class="notranslate">entryComponents</code> property to a test module, and then import that module.</p>
<p dir="auto"><strong>Minimal reproduction of the problem with instructions</strong></p>

<p dir="auto">I've replicated the functionality of the portion of my app in question - <a href="http://plnkr.co/edit/Wk6H5s5g3cAXRdGyTuhu" rel="nofollow">View the reproduction plnkr here.</a> <strong>Please Note:</strong> I'm not sure how to actually execute a jasmine test in Plnkr as I haven't used Plnkr much. If I had more time, I'd get it up and running, but hopefully my diagnostic description can suffice.</p>
<p dir="auto"><strong>What is the motivation / use case for changing the behavior?</strong></p>

<p dir="auto">Having to create a whole separate module to import into my testing module doesn't align to the actual structure of my application's code. It's not clear why <code class="notranslate">entryComponents</code> is not included in the TestModuleMetadata, so it is unclear to me whether my stylistic approach to my application's structure is the problem or if it's just a simple omission to the TestModuleMetadata that can be easily implemented? To me, it seems as though the test environment should replicate my application environment as closely as possible, maybe some others agree?</p>
<p dir="auto"><strong>Please tell us about your environment:</strong></p>

<ul dir="auto">
<li><strong>Angular CLI:</strong> v1.0.0-beta.32.3</li>
<li><strong>Windows:</strong> v10</li>
<li><strong>Sublime Text:</strong> v3</li>
<li><strong>NPM:</strong> v3.10.10</li>
<li><strong>Node:</strong> v6.9.5</li>
<li><strong>Typescript:</strong> ~2.0.10</li>
<li><strong>Karma:</strong> 1.2.0</li>
<li><strong>Angular version:</strong> 2.4.7</li>
</ul>

<ul dir="auto">
<li><strong>Browser:</strong> [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]</li>
</ul>

<ul dir="auto">
<li>
<p dir="auto">Chrome (*(Karma-chrome-launcher:** v^2.0.0)</p>
</li>
<li>
<p dir="auto"><strong>Language:</strong> [all | TypeScript X.X | ES6/7 | ES5]</p>
</li>
<li>
<p dir="auto">Typescript</p>
</li>
<li>
<p dir="auto">ES6</p>
</li>
<li>
<p dir="auto"><strong>Node (for AoT issues):</strong> <code class="notranslate">node --version</code> =<br>
<strong>Node:</strong> v6.9.5</p>
</li>
</ul>