get updated property value in view form field
In the simple page I have a public property
public int $strengthScore = 0;
I set it using the $set
method.
But how to get strengthScore
value in the ViewField after it is updated?
Tried $wire.$entangle
in the x-data
but it get only the initial value.
Solution:Jump to solution
Sending event:
```php
$score = (new Zxcvbn())->passwordStrength($password)['score'];
$set('strengthScore', $score);
$this->dispatch('update-score', score: $score);...
7 Replies
Not sure but if I'm reading this correctly, you could bind the value attribute to the Alpine state instead of the Livewire state:
that's not the issue. solved it by using events
That's great. Can you share a bit more info on your solution? Maybe it can be useful for other people in the same situation?
Solution
Sending event:
and in the blade
Very cool! Thanks for sharing @krekas
np