$watch not work in x-init within the modal component
armandoperez083 opened this issue · 1 comments
armandoperez083 commented
Describe the bug
I found that modals are not working because they $watch not work in x-init if it is removed if it works
Solution
` x-init="() => {
let el = document.querySelector('#modal-id-{{ $id }}')
let modal = new bootstrap.Modal(el);
if (show) {
modal.show()
} else {
modal.hide()
}
el.addEventListener('hide.bs.modal', function (event) {
show = false
})
}"`
Desktop (please complete the following information):
- OS: W11
- Browser Edge
- Version 101.0.1210.53
seuaCoder commented
With this code, the modal is working only one time