$watch( ['array','of','var'] ... callback (value, oldValue) => ... value should be an array... ? #2499
Ronan-Lenor
started this conversation in
3. Feature Ideas
Replies: 1 comment 8 replies
-
I think it works by chance but it's not actually supported. :) Probably it works because of the workaround to enable deep watching with arrays so it's subjected to breaking changes if that workaround changes for any reason. <div x-data="{foo: 1, bar: 2}" x-init="()=> $watch('[foo, bar]', (value, oldValue) => console.log(value, oldValue))"> |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
when i $watch multiple variable by using an array in the first parameter, all variables are succefully watched.
But the value that is passed in the parameter is only the value of the first variable writed in the array.
so, i was wondering if when a array is given in the first parameter of $watch, you could pass the full array of variables in the callback instead of only its first index.
Thanks,
Beta Was this translation helpful? Give feedback.
All reactions