Last Updated: February 25, 2016
· steveduitsman

Debugging Knockout Model Bindings

If you've ever found yourself wondering what is going on with your Knockout bindings, add the following to your markup.

<pre data-bind="text: ko.toJSON($data, null, 2)"></pre>

You can give it a different binding context ($data) as well, so if you only care about a specific section of your bindings you can limit what this debug output to only that.

Found on StackOverflow