Reputation: 35
I have a problem, I don't know how to implement the foreach in html list. Here is my code:
<ul class="dropdown-menu">
<li class="form-group col-sm-12 bg-orange">
<p>Alert Messages</p>
</li>
<!-- ko: foreach: TopAlertMessage -->
<li class="col-sm-12">
<a href="#" class="row btn">
<p data-bind="text: Message"></p>
</a>
</li>
<!-- /ko -->
<li class="form-group col-sm-12 alert-footer">
<p class="row color-orange" data-bind="click: ClickViewAllTask">
view all tasks
</p>
</li>
</ul>
TopAlertMessage Values are as follows:
and this is the list UI
Hope someone can help me.
Upvotes: 0
Views: 37
Reputation: 6372
Your code looks fine, other than the fact there shouldn't be a :
after ko
in the comment tag:
<!-- ko foreach: TopAlertMessage -->
Upvotes: 2