DEV Community

Discussion on: Help on Creating Modal using Angular

Collapse
 
glebirovich profile image
Gleb Irovich

Hey! Putting aside the fact that manipulating the dom via vanilla js is not an angular way of dealing with things, I also find it wrong to pass function as an input. It would be perfectly fine in the React world, but in Angular you should be emitting close event in the child and binding closeModal to close Output.

If you want to make it even more β€œAngular-ish”, I would suggest creating a directive, that would listen to the close event via HostListener and change the class of the host via HostBinding.

Collapse
 
debbiswasgit profile image
debbiswas

Hi Glen, Many thanks for your inputs . I was able to do it by Emitting close event and it worked. I am however trying use the Host Listener as you suggested. I will come back once that is done. Again thanks.