How does this work? (dispatch to wire:model)

In Caleb’s video, in his screencast series “Custom Form Inputs” Episode “Using a datepicker: Pikaday” he demonstrate using $dispatch to send input event to wire:model.

What I don’t understand is that he is dispatching from the parent div (alpine) but the wire:model attribute is forwarded (from the blade component attribute) to the input inside the alpine div. So the wire:model in the rendered component is down the tree, not up.

I thought $dispatch, dispatched events up not down? If he is only dispatching ‘input’ event, then how does what ever receiving know it’s for this particular model?

The commit is (sponsored access) https://github.com/livewire/surge/commit/636d7b2927352326f1c7a58e5b6116d464d76b78#diff-027b6a4cf0e23d721c7ec4aa0d059272b38ef3c86756a1d9a7aa8dc78eb5332e

The video, at around 17:56 in is https://laravel-livewire.com/screencasts/s4-date-picker

Any help will be appreciated! :slight_smile: