chap3 -> Creating a binding to debug - the toJSON binding
This commit is contained in:
parent
f6a61ea524
commit
be3a58c325
@ -19,6 +19,7 @@
|
||||
</div>
|
||||
<div data-bind="template: {name:'add-to-catalog-modal'}"></div>
|
||||
<div data-bind="template: {name:'finish-order-modal'}"></div>
|
||||
<pre class="well well-lg" data-bind="toJSON: $root"></pre>
|
||||
</div>
|
||||
|
||||
<!-- vendor library -->
|
||||
|
@ -23,3 +23,11 @@ ko.bindingHandlers.currency = {
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
ko.bindingHandlers.toJSON = {
|
||||
update: function (element, valueAccessor) {
|
||||
return ko.bindingHandlers.text.update(element, function () {
|
||||
return ko.toJSON(valueAccessor(), null, 2);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user