2

I'm generating a list of links and they have not the same text but I don't know how to put a text with knockout.

This is what I have:

<a data-bind="attr: { href: 'Controller/Method/' + Id, 'Title': CurrentTask }">
     <!-- I need the name of the CurrentTask here-->
     CurrentTask
</a>

So, the text I want to show appears only in the "alt" property but not in the text of the link. It works but I need that the name of the CurrentTask be the link and now it's just showing me everything like this:

<a href...>CurrentTask</a>
<a href...>CurrentTask</a>
<a href...>CurrentTask</a>
<a href...>CurrentTask</a>

and I need this

<a href...>I get this data from de controller</a>
<a href...>Sometext</a>
<a href...>OtherText</a>
<a href...>Anything</a>
4

1 回答 1

4

使用text绑定。

<a data-bind="attr: { href: 'Controller/Method/' + Id, 'Title': CurrentTask }, text: TaskName">
</a>
于 2013-06-24T22:18:25.303 回答