Understanding $watch #1539
Answered
by
KevinBatdorf
Chandler-Zhu
asked this question in
1. Help
-
Beta Was this translation helpful? Give feedback.
Answered by
KevinBatdorf
Jun 17, 2021
Replies: 1 comment
-
When you use Maybe a good way to think about it is you're "registering" a long-running watcher? |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Chandler-Zhu
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When you use
$watch
you're telling Alpine to monitor a property long term (open
in your example) and fire a callback (console.log()
) when that property changes.x-init
is the perfect place for that since you only want it to register the watcher one time.Maybe a good way to think about it is you're "registering" a long-running watcher?