How do change binding handler based on a condition?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


How do change binding handler based on a condition?



I want to use a different binding handler for a table column based on a condition, for example:


<tbody data-bind="foreach: plansList">
<tr>
<td data-bind="numVotes > 0 ? (html: voteOptionLinked) : (text: voteOption)"></td>



In one case, there is a link that I want to bind using the html handler but in the other case I just want to display it using the text handler. The above doesn't work because the handler: has to come at the beginning of the data-bind attribute, but is there a way I can do this in Knockout?


html


text


handler:


data-bind









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Visual Studio Code: How to configure includePath for better IntelliSense results

C++ virtual function: Base class function is called instead of derived