title: How to pass a component as input to another component?
body: <p>I'm using ngx-bootstraps modal component, and I want to dynamically pass its components to display. I'm not sure how to do this. </p>
  
  <p>I'm using the following example, components as content:
  <a href="https://ng-bootstrap.github.io/#/components/modal/examples" rel="nofollow noreferrer">https://ng-bootstrap.github.io/#/components/modal/examples</a></p>
  
  <p>I can't pass it with @Input() since it's not an instance of a variable.</p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
  import { ActualContentComponent} from 'path/path/path';
  
  //TODO: Fix hard important of a component
  @Component({
    selector: 'srd-modal',
    templateUrl: './srd-modal.component.html',
    styleUrls: ['./srd-modal.component.css']
  })
  export class SharedModalComponent implements OnInit {
  
    constructor(private modalService: NgbModal) {}
  
    open() {
      const modalRef = this.modalService.open(ActualContentComponent);
      modalRef.componentInstance.name = 'content';
    }
  
    ngOnInit() {
    }
  
  }
  </code></pre>
  
  <p>The above example works, however, I have a hard reference to the 'ActualContentComponent'. I'd prefer to avoid a giant switch to see what component to actually open (by passing in the name of the component).</p>
  
  <p>EDIT: 
  I found out I can actually pass the component with @Input()</p>
  
  <pre><code> @Input()
   public component;
  
   constructor(private modalService: NgbModal) {}
  
   open() {
      const modalRef = this.modalService.open(this.component);
      modalRef.componentInstance.name = this.buttonTitle;
    }
  </code></pre>
  
  <p>I was under the assumption that this wouldn't be possible according to some search results. I was wondering what data-type I should use for component though.</p>
  
  <p>EDIT 2: I guess Type according to <a href="https://angular.io/api/core/Type" rel="nofollow noreferrer">https://angular.io/api/core/Type</a></p>