Toggle Alpine Modals Using Events
If you need to toggle an Alpine modal from anywhere in your application, it might be useful to reach for an event-based approach. In this lesson, we'll add a $modals.show('modal-name') API for activating any registered modal. To allow for this, we'll dispatch an event on the window object, and then listen for it from our modal Blade component.