KnockoutJs Anchor 标签绑定附加 HTML

KnockoutJs Anchor tag binding with additional HTML

在 Html 我有以下内容

 <a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">My Company<b class="caret"></b></a>

生成一个 link,末尾有一个插入符号。

使用 knockoutJS,有了这个,

<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-bind="attr: { title: someTextBinding }, text: someTextBinding"><b class="caret"></b></a> 

如何让克拉保持在屏幕上?我试过使用计算器,但插入符号以文本形式发送?

像这样使用containerless syntax for text binding

<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-bind="attr: { title: someTextBinding }">
  <!--ko text: someTextBinding-->
  <!--/ko-->
  <b class="caret"></b>
</a>

The <!--ko--> and <!--/ko--> comments act as start/end markers, defining a “virtual element” that contains the markup inside. Knockout understands this virtual element syntax and binds as if you had a real container element.