billpull / knockout-bootstrap

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

Passing data to popover template #73

Closed leqwasd closed 9 years ago

leqwasd commented 9 years ago

Hi, I decorated my control like this: <input class="form-control" type="text" data-bind="value: url, popover: {template: 'popoverTemplate', title: '', data: urlErrors, options: {placement: 'top'}}" />

urlErrors is observableArray with objects. At first, I did <div data-bind="text: ko.toJSON($root, null, 2)"></div> in template, and it showed me { "template": "popoverTemplate", "data": [ { "message": "Item 1!" }, { "message": "Item 2!" }, { "message": "Item 3!" } ] }. Then I thought - oh, data contains my items, I should iterate over them with <!-- foreach: data -->.That didnt work. Well, it did one iteration. It considers data as 1 item, not as an array. What do I need to do, to get me <p data-bind="text: message"></p> for every item in data?