billpull / knockout-bootstrap

A plugin that adds custom bindings for twitter bootstrap objects such as tooltips and popovers.
233 stars 69 forks source link

conditional popover #56

Open mikehaas763 opened 10 years ago

mikehaas763 commented 10 years ago

Looking for opinions. Does it seem like giving the popover binding (or tooltip, etc) a conditional option is a bad idea? I'm thinking it probably is but want input from others.

Current way:

<!-- ko if: someCondition -->
<img data-bind="popover: {template: 'popoverTemplate', trigger: 'click'}" src="img.png">
<!-- /ko -->
<!-- ko ifnot: someCondition -->
<img src="img.png">
<!-- /ko -->

or if there was another option

<img data-bind="popover: {enabled: someCondition, template: 'popoverTemplate', trigger: 'click'}" src="img.png">
billpull commented 10 years ago

I am not opposed to the idea the code certainly looks cleaner.