Hello everyone,
I am trying to open a model, but for some reason it wont open at all.
I tried the way it is written on the documentation.
Controller:
namespace App\Http\Livewire\Tags;
use Livewire\Component;
class TagEditModal extends Component
{
public $isOpen = false;
protected $listeners = ['showModal' => 'open'];
public function open()
{
$this->isOpen = true;
}
public function render()
{
return view('livewire.tags.tag-edit-modal', ['isOpen' => $this->isOpen]);
}
}
Blade view:
<div>
@if($isOpen)
<div class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Test</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p>Modal body text goes here.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary">Save changes</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
@endif
</div>
The modal gets opened on an other component. I see that the requests are beeing made, but nothing get open.
If I put a normal <h1>Hello World</h1>
on my blade view it get shown, but for some reason the modal not.
EDIT:
Tried giving the modal an ID and opening it through:
@push('scripts')
$('#myModelID').modal('show');
@endpush
And this wont work at all.
I am close to give up on Livewire. ;o(
Thanks in advance