Alpine: Modify x-data properties from outside component

Created on 2 Jan 2020  路  3Comments  路  Source: alpinejs/alpine

I'm using livewire and triggering an event that I'm trying to listen to in alpine. What's the best way to do this?

Most helpful comment

This has been added in the latest Livewire release.

All 3 comments

For a temporary work around I'm listening for the livewire event and then firing a window event and listening for that with x-on.

Hey @andruu, I recently came across this myself.

I'm adding a Livewire component method in the next release:

$this->dispatchBrowserEvent('foo')

that can be called from the backend, and the root div of the livewire component will dispatch this. Then Alpine can listen for it.

This has been added in the latest Livewire release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bep picture bep  路  4Comments

imliam picture imliam  路  5Comments

ryangjchandler picture ryangjchandler  路  3Comments

mrmathewc picture mrmathewc  路  4Comments

adinata-id picture adinata-id  路  4Comments