Last Updated: February 25, 2016
·
3.352K
· 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

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside