jetstrap icon indicating copy to clipboard operation
jetstrap copied to clipboard

$watch not work in x-init within the modal component

Open armandoperez083 opened this issue 2 years ago • 1 comments

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

armandoperez083 avatar May 27 '22 00:05 armandoperez083

With this code, the modal is working only one time

seuaCoder avatar May 29 '22 15:05 seuaCoder