billpull / knockout-bootstrap

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

Knockout 'click' event within popover #45

Open Mior opened 10 years ago

Mior commented 10 years ago

Problem occurs when using binding with 'data' in popover with 'click' knockout binding. Click binding doesn't seems to work. Solution could be to have binding within click function of custom binding for popover.

binding: data-bind:"popover: {template: 'popoverBindingTemplate', placement:'bottom', data: $someData}"

template:

<script type="text/html" id="popoverBindingTemplate">
    <button class="close" data-dismiss="popover" type="button">
        <i class="fa fa-times"/>
    </button>
    <ul class="list-unstyled ce-tag-list" data-bind="foreach: messages">
        <li>
            <a class="label label-primary" href="#" data-bind="click: function(){alert('Click');}, text: label"></a>
        </li>
    </ul>
</script>
bertvh commented 9 years ago

Doesn't work for me either. In fact, I can't get any binding inside a popover to work. It's only click events.