How to make a console log inside a knockout template

I thought it was right:

<div data-bind="foreach: amount_options, visible: $parent.displayAskAmoutRadioButtons()"> <!-- ko console.log(amount_option) --><!-- /ko --> <label class="donor-js-amount-choice"> <!-- <input type="radio" class="donor-js-webware" name="gift_amt" data-bind="attr: {value: key}, checked: $parent.amountSelected"><span class="donor-js-currency-symbol" data-bind="html: $root.session.currencySymbol"></span>&nbsp;<span class="donor-js-input-currency" data-bind="text: desc"></span>&nbsp;<span class="donor-js-input-currency"></span><br> --> </label> </div> 

apparently not like nothing goes to the console. The commented tag line throws an error about value: key , and I need to know what's inside one of these amount_options .

Ideas?

+7
source share
1 answer

Try it. The knockout should evaluate the value of the binding and hide the console.

 <div data-bind="text: console.log(amount_option)"></div> 
+12
source share

All Articles