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?
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?