I have a simple component :
class SearchTypeClient extends Component
{
public $search;
public function render()
{
Log::info('search = ' . $this->search );
$tabTypeClient = TypeClient::where('label', 'like', '%' . $this->search . '%')->get();
return view('livewire.search-type-client' , [
'tabTypeClient' => $tabTypeClient,
]);
}
}
Here is the view :
<div>
Recherche : <input wire:model="search" type="search" />
{{ $search }}
</div>
My component is included with @livewire('searchTypeClient') and is correctly displayed.
But when I type something in the input text, the value of the $search variable is never updated. In the log, I can see $search is always empty.
I have no JS errors in the Chrome console. I have seen on other posts that this issue can occur when there is no one root element in the view. But as you can see, I have my
Livewire style and javascript are correctly included (I can see them in the source).
@livewireStyles
</head>
@livewireScripts
</body>
Any clue ?
Thanks
OK I found it. I had to write wire:model.live instead of wire:model
I guess I read an outdated documentation