-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Can I $watch whole $data but except some properties? #350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Or if I could know which property get changed in the $data, the problem can be solved too. |
There are a few ways. You can just make the properties a separate object and watch that...
... or, as the documentation says, "Additional properties attached to the ViewModel or the data object in the ready hook will not be observed." , so you can introduce this.result="" there. Alternatively, again as the docs say, when it comes to processing object in $data, "Properties with keys that starts with $ or _ are skipped." , so you can just rename to "$result" or "_result". |
Thank you @bdaglish, but I made some test, the result is still not what I want: Way 1: Use a wrapper scope for not watching "result", can solve my problem, but I feel it's not so good.. |
Interesting use case - I can make some improvements to the Im the meanwhile, grouping them into different objects seems to be the easiest workaround. |
Okay, I'm using the "grouping" way to fit my case, and looking forward to "$watch" new feature. : ) |
I closed it too fast, the "grouping" way make my code be fatter... |
@asip , the key problem: |
See the code here:
Did I use it in the right way?
The text was updated successfully, but these errors were encountered: