Skip to content
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

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

Open
armandoperez083 opened this issue May 27, 2022 · 1 comment
Open

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

armandoperez083 opened this issue May 27, 2022 · 1 comment

Comments

@armandoperez083
Copy link

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
Copy link

With this code, the modal is working only one time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants