For debug purposes, I’m trying to display the current content inside a foreach loop like this, but I’m getting an “Unable to parse bindings” error. You can see my atteping inside the ‘pre’ tag at the bottom of the item. Any suggestions for how to properly display this?
<!-- ko foreach: criteria -->
<div>
<span data-bind="text: myVal"></span>
<label><input type="radio" value="AND" data-bind="checked: logicGate">AND</label>
<label><input type="radio" value="OR" data-bind="checked: logicGate">OR</label>
<a href="javascript:void(0)" data-bind="click: $parent.remove">Remove</a>
<pre data-bind="text: ko.toJSON($data, null, 2)"></pre>
</div>
<!-- /ko -->
The problem was that I was passing elements into the object’s constructor and they can’t be serialized by the ko.toJSON method.