M
M
Masterstvo2017-06-14 14:19:41
Angular
Masterstvo, 2017-06-14 14:19:41

What is the easiest way to add a component that is not in the DOM on an event on another component in Angular2?

Good afternoon! Can you please tell me how easy it is to add a component that is not in the DOM on an event on another component in Angular2 (something like popup)?
Let's say there is a component that is described and declared in app.module, but is not displayed anywhere in the warm. I want this component to appear in the root app component (well, or in another component) with a certain event on another (existing in the DOM) component. This can be somehow implemented without using the ngIf structural directive.
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
ozknemoy, 2017-06-14
@Masterstvo

either use a modal or toast( https://github.com/PointInside/ng2-toastr). I use this and that

N
Nicholas, 2017-06-14
@healqq

See how ngIf
is implemented. Based on this, you can make your own bicycle.
But in general, I think you should use a router for such operations.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question