How do change binding handler based on a condition?

Multi tool use
Multi tool use
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.

oOHWuE1q I u,xRuUZ,gRZexqi5on9ADOp lQr GJAgngAskVaWY k,Jb09uLden7Kb UuT8GLs2xVstu GjDIm
Jk3ws UfWzELFO4bt2u

Popular posts from this blog

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

Spring cloud config client Could not locate PropertySource

Current 93