Search code examples
htmlknockout.jsknockout-3.0

How to comment out knockout code in HTML


Is there any to comment out a knock out code in HTML, since the ko code is already in default html comment block.

<!-- ko if : isEditable() -->
    <!-- Edit Mode -->
    <div class="edit">Edit mode</div>
<!-- /ko -->

Can I comment the above section in my html


Solution

  • Just change the ko to anything else!

    <!-- koc if : isEditable() --> or <!-- kcomment if : isEditable() --> anything other that ko makes it as a comment.

    As knockout looks only for html comments that start with ko, anything other than ko on an html comment will simply be a comment.