I have a component defined "FancyButton". I have it here in the template:
...
<div class="container">
<div class="fancy">
<fancybutton></fancybutton>
</div>
<button (click)="removeFancyButton">Remove</button>
<button (click)="addFancyButton">Add</button>
</div>
...
My question is, How can I programatically remove:
<div class="fancy">
<fancybutton></fancybutton>
</div>
When I click on the remove button? Conversely, how do I add it back in? I would like it to trigger ngOnDestroy if possible, and if its "re-added", trigger ngOnInit when added back in.
This is my fancy-button component, below is the parent template that i have the fancy-button integrated in within the home.component.html:
@Component({
selector: 'fancy-button',
template: `<button>clickme</button>`
})
export class FancyButton {}
@Component({
selector: 'home', // <home></home>
providers: [
Title
],
styleUrls: [ './home.component.css' ],
templateUrl: './home.component.html'
})