I
I
Ivan Stroykin2017-02-04 22:21:34
Angular
Ivan Stroykin, 2017-02-04 22:21:34

Angular2: How to properly push ng-bootstrap modal to child component?

Good day,
I can’t fully understand ng2-bootstrap, namely modal. If in one component, then everything is easy, but if you put the modal into a separate component (child), then it doesn’t work.
Maybe someone has already done these manipulations?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Stroykin, 2017-02-06
@StivinKing

In general, who will need it or just be interested. Implemented.
Let's say the selector is: "test-modal". Then, where it will be necessary to display this modal window, we write:
and we hang an event on the button:
in the modal window component we write:

@ViewChild('testModal') public testModal: ModalDirective;

public showTestModal(): void {
    this.testModal.show();
}

public hideTestModal(): void {
    this.testModal.hide();
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question