KnockoutOut JS - Why Are These Values Not Binding Correctly?
I have this knockout observable array and I am trying to bind some of its values to my view. Where I am having difficulties is because its nested. I am not sure what the correct da
Solution 1:
Because your advertiser
is ko.observable
you need to get its value with advertiser()
if you are using it inside an expression:
<table>
<tr>
<td>
<input data-bind="value: advertiser().advertiserName" />
</td>
<td>
<input data-bind="value: advertiser().advertiserRank" />
</td>
</tr>
</table>
Or you can use the with
binding:
<table data-bind="with: advertiser">
<tr>
<td>
<input data-bind="value: advertiserName" />
</td>
<td>
<input data-bind="value: advertiserRank" />
</td>
</tr>
</table>
Post a Comment for "KnockoutOut JS - Why Are These Values Not Binding Correctly?"