I want to open or close modals from Another Module with the help of component 1. But currently I am unable to access the modalRef of ngBootstrap of the modals in that component so that I can close/open it.
Suppose this scenerio
One Module
<component1></component1>
Another Module this module have multiple components and each component have modal in it which I need to show or hide based on the conditions from component 1.
<component2> //have ng bootstrap modal in it </component2>
<component3> //have ng bootstrap modal in it </component3>
<component4> //have ng bootstrap modal in it </component4>
<component5> //have ng bootstrap modal in it </component5>
<component6> //have ng bootstrap modal in it </component6>
Currently I am doing this by just putting one hidden button in that module and the click it using the JavaScript from another component, I know that this is not a good approach so I want someone to give me some approach to calling these modals or tell me if there is anything to change in the design.
As far as I know I think service will be good to do this. But before changing the design I want someone opinion. Thanks