If you need other components to be able to do then you can do the following. As I've mentioned this is part of the roadmap but not implemented yet. Toying around with the NgbModal and want to trigger the open method -> open (content: string | TemplateRef<any>, options: NgbModalOptions) <- from somewhere else than the template code. I would prefer to allow the service that handles the error handling (rerouting, displaying a warning) to dismiss any open modals, without really caring how they were created in the first place. It works great with the Angular framework and helps in developing awesome applications. Published by at February 16, 2022. What Is the Difference Between 'Man' And 'Son of Man' in Num 23:19? The following command would be entered into a terminal but make sure you are standing inside the directory/folder where you want this component to be made. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. code of conduct because it is harassing, offensive or spammy. "), content-component subscribes to the modal-button (by a service), content-component (or even a subcomponent or a service) wants to close the modal after performing actions -> not possible because it has no reference. I can open and close modals there is no problem in this. How can I explain to my manager that a project he wishes to undertake cannot be performed by the team? Feature request: change NgbModalRef's options after the modal - GitHub And with all these changes it will work like charm. Extend the ModalComponent class and implement any content you want. Euler: A baby on his lap, a cat on his back thats how he wrote his immortal works (origin?). Pass data from one Component to another Component in angular4, Angular ng-bootstrap Modal Open Doesn't Support TemplateRef as Custom Component Passed from Template. Can airtags be tracked from an iMac desktop, with no iPhone? The regular Modal looks like this: And it's perfectly fine if you have one or two Modals and they don't have any logic behind, besides popping up as in an About Modal, but what if you have 3+ Modals with full logic?