【发布时间】:2018-08-20 05:08:27
【问题描述】:
我有以下模型绑定。
<!-- ko foreach: RctApplyVacancy.RctVacancies -->
<tr>
// Some TD elements
// Following binding works
<td class="rct-vmiddle text-center" style="width: 8%;">
<input type="button" data-bind="click: RctApplyVacancy.Apply" />
</td>
<td class="rct-vmiddle text-center" style="width: 4%;">
<a data-toggle="popover" data-container="body" data-placement="right"
type="button" data-html="true" href="#" data-bind="attr: { id: 'Share' + AdvId() }">
<i class="fa fa-share-alt" aria-hidden="true"></i>
</a>
<div data-bind="attr: { id: 'popover-content' + AdvId() }" class="hide">
<ul class="list-group">
<li data-bind="click : RctApplyVacancy.Apply">
<i class="classes" aria-hidden="true"></i></li> // This won't
</ul>
</div>
</td>
</tr>
<!-- /ko -->
根据 cmets,后半部分的绑定(请关注评论 This won't)不起作用。有人可以解释一下为什么吗?我在这里做错了什么?
P.S 如果需要,请在 cmets 中请求更多详细信息。为了清楚起见,我省略了 ViewModel。
【问题讨论】:
-
“为了清楚起见,我省略了 ViewModel。” 简洁,也许;不清晰。 (下一次,包括一个minimal reproducible example。)
-
糟糕!选词错误。 :D 是的,它很简洁.. 感谢您的提示..
标签: javascript knockout.js viewmodel model-binding