5

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

12
  • remove from where? Commented Sep 23, 2017 at 5:30
  • How did you create them? Commented Sep 23, 2017 at 5:31
  • I have created these dynamic components from drag elements within drop area. Now I need to delete specific dynamic component after clicking delete button within the component. Commented Sep 23, 2017 at 5:34
  • Please create minimal reproduction on plunker Commented Sep 23, 2017 at 5:43
  • @yurzui i'm doing that, thanks Commented Sep 23, 2017 at 5:50

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.