appendComponentToBody is not working in my code..I can not findout where I did mistake.Please help me how to resolve this issue.
See my code:https://stackblitz.com/edit/angular-axhgid?file=src%2Fapp%2Fdialog%2Fdialog.component.ts
dialog.component.ts
constructor(private domService: ModalService) { }
ngOnInit() {
this.domService.appendComponentToBody(DialogComponent);
}
I have a created a Simple Example adding a component dynamically and removing it using two buttons.
Please have a look, it doesn't have complications.
Refer: https://stackblitz.com/edit/angular-nvnue8?file=src%2Fapp%2Fmodal.service.ts
Now edit it to suit your needs
It was difficult to comprehend your code and hence I made this snippet for you