-
-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Opening modal from blade component #60
Comments
I might not be the best person to help you get this sorted out, but I'm not seeing either an error message or an explanation what's going wrong, so right now, it's pretty difficult to help :) |
Hi there - I have run into the same issue - following the exact example in the readme trying to pass a model ID to the modal and it throws the following error:
(*** just hiding personal details) |
@designvoid change your property from: |
Ran into the same issue. The docs should be updated accordingly @PhiloNL :) . |
I thought Livewire itself didn't have this issue? Correct me if I'm wrong though! |
@PhiloNL thanks for the great component. This one issue is weird tho. |
😕 |
Sorry, thought the issue was fixed 😅 |
Have you tried using the |
Yup both json and the new js directive. Same story. |
How about moving the encoding inside the button component? Not sure if this makes a difference but worth a try.
|
Tried it. Didn't help. I don't think the problem is in how we send the data, that part is fine. The problem is in where and how we resolve the model. We need to resolve the model sooner so the "int" turns into a "Model" before we try to assign the data to the property. |
I have the same experience using Livewire 2.7.2 and Alpine.js 3.6.1. My workaround: class EditUserModal extends ModalComponent
{
public User|int $user;
public function mount(User|int $user)
{
$this->user = $user instanceof User ? $user : User::find($user);
}
} <button wire:click.prevent='$emit("openModal", "edit-user-modal", @json(['user' => $user->id]))'>Edit</button> |
Same issue here, but the fix @mpskovvang proposed still doesn't work for me. |
Hey, thanks for making such a great package. Super simple to use.
I have setup a button to trigger a modal, passing a value from the page I am on:
This works perfectly, passes the data I want. Great!
We are using blade components on the site to keep the styling of every button the same. So I use:
This also works! But, when I try to pass a value, it breaks. I've tried (what I feel like) all sorts of different quote combinations as i saw your
(notice the single quotes)
comment in docs.Am I missing something really obvious?
Using version 1.0.0
Thank you!
The text was updated successfully, but these errors were encountered: