title: ngOnInit is not called on dynamic component
body: <p>I'm using Angular 8 for a project, and I'm having trouble launching a dynamic component because ngOnInit doesn't get called. I've build a directive called PlaceholderDirective, shown below:</p>
  
  <pre><code>@Directive({
    selector: '[appPlaceholder]'
  })
  export class PlaceholderDirective {
    constructor(public viewContainerRef: ViewContainerRef) {}
  }
  </code></pre>
  
  <p>And used that directive on a ng-template:</p>
  
  <pre><code>&lt;ng-template appPlaceholder&gt;&lt;/ng-template&gt;
  </code></pre>
  
  <p>The component that holds the HTML where the ng-template lies launches the dynamic component, as such:</p>
  
  <pre><code>@ViewChild(PlaceholderDirective, {static: false}) private placeholder: PlaceholderDirective;
  ...
  constructor(private componentResolver: ComponentFactoryResolver) {}
  ...
  public launchSensorEditComponent(id: number) {
      const componentFactory = this.componentResolver.resolveComponentFactory(SensorEditComponent);
      const hostViewContainerRef = this.placeholder.viewContainerRef;
      hostViewContainerRef.clear();
      const sensorEditComponentRef = hostViewContainerRef.createComponent(componentFactory);
      sensorEditComponentRef.instance.sensorId = id;
  }
  </code></pre>
  
  <p>The actual dynamic component is very simple, and its registered in the entryComponents section in AppModule. I've narrow it down to the bare minimum in order to understand what's wrong:</p>
  
  <pre><code>@Component({
    selector: 'app-sensor-edit',
    templateUrl: './sensor-edit.component.html',
    styleUrls: ['./sensor-edit.component.css']
  })
  export class SensorEditComponent implements OnInit {
    @Input() sensorId: number;
    private showDialog: boolean = false;
  
    constructor() {
      console.log('constructor');
    }
  
    ngOnInit() {
      console.log('ngOnInit');
      this.showDialog = true;
  }
  </code></pre>
  
  <p>Last, the HTML for the dynamic component:</p>
  
  <pre><code>&lt;div *ngIf="showDialog"&gt;
    &lt;h3&gt;its not working&lt;/h3&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The problem is that ngOnInit from the dynamic component doesn't get called and I have the rest of the data to initialize in there, so that I can build the rest of the template.</p>
  
  <p>The really weird part is that if my console is not opened, and I open it or vice-versa, the template is shown.</p>