I have created some dynamic components like -
<div>
<ang-textfield></ang-textfield>
<ang-textarea></ang-textarea>
<ang-checkbox></ang-checkbox>
</div>
Within specific dynamic component
there are some elements like -
<ang-textfield>
<input type="text" />
<button>Settings</button>
<button (click)="remove_component()">Remove</button>
</ang-textfield>
I want to remove current component after clicking Remove
button.
How can i do that?
Here is the plunker
You can Pass the component factory as a Reference to the Dynamic Build Component and then in the Dynamic Component Have a button Destroy .
This Gist will give you a Clearer Idea.
A live Example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With