Accessing data in ViewFiled

Hey guys, I have simple ViewField and according documentation I am trying to send some additional data to view with ->viewData(). But I don’t get it how to Access them in view after. Thanks for your help. I manage to find them in $field but since it’s protected I cannot use it.
Solution:
So you access it just as you would any livewire passed element. with the key so:
->viewData(['field1' => 'my text'])
->viewData(['field1' => 'my text'])
...
Jump to solution
4 Replies
Solution
toeknee
toeknee12mo ago
So you access it just as you would any livewire passed element. with the key so:
->viewData(['field1' => 'my text'])
->viewData(['field1' => 'my text'])
you would access it with:
{{ $field1 }}
{{ $field1 }}
toeknee
toeknee12mo ago
You can also use $getState() to get the components data
TomášZ
TomášZOP12mo ago
omg, so simple! 🙂 thanks lot.
toeknee
toeknee12mo ago
Most welcomes!
Want results from more Discord servers?
Add your server