After reading the Knockout documentation on Binding Context, I would expect
this HTML:
<div data-bind="with: blah">
<pre data-bind="text: ko.toJSON($context, null, 2)"></pre>
</div>
and this JS:
var viewModel = {
blah: {
hello: "hello",
}
};
ko.applyBindings(viewModel);
would print this:
blah: {
hello: "hello",
}
However, I get the following error:
Error: Unable to parse bindings. Message: Error: Pass a function that returns the value of the ko.computed; Bindings value: text: ko.toJSON($context, null, 2)
How should it be used?
JsFiddle for reference.