PHPnews.io

Toggle Alpine Modals Using Events

Written by Laracasts / Original link on Mar. 3, 2021

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.

laracasts

« Git Support is Coming to the Laravel Installer - GitHub Availability Report: February 2021 »