Tricks

Opening a modal in a blade with button outside it's trigger slot

Nov 13, 2022
Tin
Admin panel

If you like to keep your modals all in the same place as me, you will probably want to open a modal with an external button.

In my case, the button is located in the View file on the same page.

Follow this link to learn more about creating a modal in your blade file.

To open it with a button outside the modals trigger slot, you can dispatch an event with the modal ID as a handle.

Example:

To open a modal with a click of a button, simply dispatch an event with that modal id as an identifier.

No comments yet…