ng2-bootstrap modal cant open modal
<p>i have an pizza.component.ts like this</p>

<pre><code>import {Component,ViewContainerRef} from '@angular/core';
import { CORE_DIRECTIVES } from '@angular/common';
import { BUTTON_DIRECTIVES } from 'ng2-bootstrap/ng2-bootstrap';
import {MODAL_DIRECTIVES, BS_VIEW_PROVIDERS} from 'ng2-bootstrap/ng2-bootstrap';

@Component({
  selector: 'pizza-com',
  templateUrl: './app/pizza/pizza.html',
  directives: [BUTTON_DIRECTIVES,MODAL_DIRECTIVES,CORE_DIRECTIVES],
  viewProviders:[BS_VIEW_PROVIDERS],
})
export class PizzaComponent {
    public constructor(viewContainerRef:ViewContainerRef) {
    // You need this small hack in order to catch application root view container ref
    this.viewContainerRef = viewContainerRef; &lt;&lt;&lt;---this doesn't seems to work dunno why
  }
}
</code></pre>

<p>and my pizza.html like this</p>

<pre><code>&lt;!-- Large modal --&gt;
&lt;button class="btn btn-primary" (click)="lgModal.show()"&gt;Large modal&lt;/button&gt;

&lt;div bsModal #lgModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true"&gt;
  &lt;div class="modal-dialog modal-lg"&gt;
    &lt;div class="modal-content"&gt;
      &lt;div class="modal-header"&gt;
        &lt;button type="button" class="close" (click)="lgModal.hide()" aria-label="Close"&gt;
          &lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;
        &lt;/button&gt;
        &lt;h4 class="modal-title"&gt;Large modal&lt;/h4&gt;
      &lt;/div&gt;
      &lt;div class="modal-body"&gt;
        ...
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>when i press the modal button it show's an error </p>

<pre><code>platform-browser.umd.js:1900 
EXCEPTION: Error: Uncaught (in promise): 
TypeError: Cannot read property 'parentInjector' of undefined
</code></pre>

<p>anything that i did wrong?</p>

<p>i also follow <a href="https://valor-software.com/ng2-bootstrap/#/modals" rel="nofollow">the example</a> in ng2-bootstrap but <strong>this.viewContainerRef</strong> seems not working</p>