knockout.js - hide tag with knockoutjs -
need knockout binding. have following tag]
<a class="link" data-bind="href: url">my url</a>
what want is, if "url" null or empty, hide tag view of user.
how can this?
you try this:
<a class="link" data-bind="attr: { href: url}, visible: url().length > 0"> url </a>
or if don't want appear in markup @ all:
<!-- ko if: url().length > 0 --> <a class="link" data-bind="attr: { href: url}"> url </a> <!-- /ko -->
Comments
Post a Comment