Skip to content

Default Value #6

Answered by dircm
bumpyy asked this question in Help
Dec 2, 2021 · 3 comments · 1 reply
Discussion options

You must be logged in to vote

You sure can! Say you were working with client models. To use the autocomplete component, you need to provide the text, ID and results as separate public properties in your parent livewire component. So for example, prior to rendering, you would set $this->clientID = clientModel->id and $this->clientName = clientModel->title. You just need to configure the component with the pre-loaded properties like below.

<x-lwa::autocomplete
    name="my-autocomplete"
    wire:model-id="clientId"
    wire:model-text="clientName"
    wire:model-results="clients"
    wire:focus="getClients"

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by bumpyy
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@joshhanley
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants