What's the difference between getting access to a view model's values through the binding properties (via valueAccessor) and getting them from the viewModel argument passed to the handler's init and update? I have always assumed the answer is that those model properties linked to valueAccessor automatically set up bindings (which would fire an update on any change to observables) but I'm not sure about that.
The valueAccessor
argument gives you access to specifically what was passed into the binding, while the viewModel
argument gives you access to the entire data object at the scope.
So, if someone says text: firstName
valueAccessor()
would give you the firstName
observable/property and viewModel
would give you access to the object that contains firstName
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With