D
D
Dmitry2017-08-04 13:42:54
Angular
Dmitry, 2017-08-04 13:42:54

How to remove an Angular2+ component?

there is a component... it has a "DelMe" button.
How to remove the component in which this button is located on pressing this button?
How to trigger the Destroy event on the current component?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Shvedov, 2017-08-04
@mmmaaak

as an option, from a component with a button, emit an event on pressing, with parameters somehow identifying this particular component. In the parent component, catch this event and hide this child component in the template using *ngIf, or filters if child components are displayed in *ngFor

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question