I'm currently working on an application with DurandalJS, BreezeJS and KnockoutJS.
Everything goes fine but the most simple thing (I believe), I can't get it to work.
In my Viewmodel I have a currentCustomer which is a ko.observable.
Via Breeze I get the customer! currentCustomer(data.results[0].Customer());
This is all working fine. If I check with Google Chrome I see the object is filled with the currentCustomer.
What I want is the following: I have an inputfield and with a value data-bind I'm trying to bind the Name of the currentCustomer to this input. But I can't get this to work. What works is this:
<input data-bind="value: currentCustomer()" />
But in the input field it only says [Object object] So there is definitely something in the currentCustomer (which is).
This is what I tried but didn't work:
<input data-bind="value: currentCustomer().Name()" />
<input data-bind="value: currentCustomer().Name" />
<input data-bind="value: currentCustomer.Name()" />
<input data-bind="value: currentCustomer.Name" />
<input data-bind="value: currentCustomer()._latestValue().Name()" />
<input data-bind="value: currentCustomer()._latestValue.Name()" />
Here is a screenshot so you can see the values are in the view!
http://s22.postimg.org/62m21nnsx/problem_data_bind.png
Have you tried using 'with'?
<div data-bind='with:currentCustomer'>
<input data-bind="value: Name/Name()" />
</div>
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