0

in my Angular 2 app I have: bla.component.html and corresponding bla.component.ts.

In bla.component.html I have modal:

<div bsModal #myModal="bs-modal" ...></div>

I would like to set this myModal into bla.component.ts:

...
export class BlaComponent {
   public myModal: ModalDirective;

I am not sure how to do it.

(What I actually want to achieve is that I will be able to close modal from component class.)

Thanks for any advice!

Tomas Marik
  • 4,053
  • 3
  • 31
  • 62

1 Answers1

0

I found the solution, just add @ViewChild('myModal') into component class:

...
export class BlaComponent {
   @ViewChild('myModal') public myModal: ModalDirective;
Tomas Marik
  • 4,053
  • 3
  • 31
  • 62