0 minutes, 26 seconds

Alpine Test $watch

Alpine supports watching for when a component’s property changes through a method called $watch().

You can "watch" a component property using the $watch magic method. For example

<div x-data="watcher()" x-init="initWatcher">
  <p>
    <label>Dollar: </label>
    <input type="text" x-model="dollar" />
  </p>
  <p>
    <label>Naira: </label>
    <input type="text" x-model="naira" />
  </p>
</div>

Previous Next