title: Angular 9 Ivy entryComponents conversion
body: <pre><code>@Component({
     selector: 'dynamic',
     template: '&lt;ng-template *ngFor="let portal of portals" [cdkPortalOutlet]="portal"&gt;&lt;/ng-template&gt;',
     // entryComponents before Ivy
     entryComponents: [Component1, Component2, Component3]
  })
  class DynamicComponent&lt;T extends BaseComponentClass&gt;() {
      portals: ComponentPortal&lt;any&gt;[] = [];
  
      constructor(@Inject(COMPONENTS_TOKEN) components: T[]) {
          // Something like this
          this.portals = components.map(c =&gt; new ComponentPortal(c));
      }
  }
  
  @NgModule({
      declarations: [
          DynamicComponent
          Component1,
          Component2,
          Component3,
      ],
      imports: [PortalModule, CommonModule, MyOtherModule]
  })
  </code></pre>
  
  <p>I have a component something like above that I create dynamically using <code>ComponentPortal</code> and <code>cdkPortalOutlet</code>. The <code>DynamicComponent</code> itself has many outlets and components that it creates. Previously with <code>entryComponents</code> I would list every component that could be loaded into the <code>DynamicComponents</code> outlets. This was working as expected, but now after upgrading to Ivy and removing deprecated <code>entryComponents</code>, this no longer works. I create <code>DynamicComponent</code> and it initializes fine, but components inside of <code>DynamicComponent</code> don't seem to be created and cause the entire <code>DynamicComponent</code> to fail its render. If I remove the outlets in <code>DynamicComponent</code> then everything else in <code>DynamicComponent</code>renders fine.</p>
  
  <p>My thoughts are that the dependency components of DynamicComponent are not resolved when creating it. The dependency components are not used in any other angular components. Am I missing something on how to convert old entryComponent behaviour to work with Ivy?</p>
  
  <p>EDIT:
  <code>"buildOptimizer": false</code> fixes it but ideally want to keep this on.</p>