<span data-bind="text: x.ID1"></span> <br />
<span data-bind="text: x.ID2"></span> <br />
<span data-bind="text: x.ID3"></span> <br /><br />
<div data-bind="foreach: x.list">
<span data-bind="text: name"></span> --
<span data-bind="text: value"></span>
<br />
</div>
I linked a jsfiddle above that includes the javascript for this issue.
When I am using data-bindings on a javascript object and one doesn't exist, it breaks nicely and just leaves a blank element. However, when using a foreach statement and something doesn't exist, it throws a javascript error and breaks the rest of the knockout bindings on the page.
Error: Uncaught Error: Unable to parse bindings. Message: ReferenceError: value is not defined; Bindings value: text: value
Any help? :(
Aucun commentaire:
Enregistrer un commentaire