Do you see any way to know when ANY model’s property has been modified through a binding? I would need something generic because it would be applied to all the forms of the application. This means I cannot just have a 'property’Changed() observable callback for every properties of the models. I’m thinking along the ways of overriding the properties setters created by the binding engine so they can call a single defined callback but I feel like there could be a better way.
相关问题
- How to deploy a web application Aurelia in an Apac
- How can I get the binding from method_missing?
- Symfony form values missing
- Binding with dictionary item by key
- Model binding of nested properties in asp.net core
相关文章
- Using relative path in assemblyBindig/linkedConfig
- WPF: Binding List to ListBox
- How can I display my user control in the MainWindo
- Attach scroll event to div with body on() binding
- Quickly create dependency properties in VS
- how to pass data when using MenuItem.ItemContainer
- Command binding Unable to cast object of type '
- WPF MVVM two-way updates
Ok, I ended up just using the binding engine to watch all properties changes. This allowed me to implement my isDirty checks without modifying the existing models...
So the final code looks like this:
my updateDirty() method is called after every property change and no change was necessary to the model.
If anyone can come up with a better solution, I'm still interested but this fits my needs for the time being.
I created a aurelia-plugin for this kind of scenario (and more). Its not exactly what your asking for, but can help you a lot. because the plugin will create a single property called
isDirty
that you can observe and fire your code accordingly.https://github.com/avrahamcool/aleph1-aurelia-utilities
look at the
Dirty Tracking a model:
section