Variable text in links with knockout

Posted by Gepser on Stack Overflow See other posts from Stack Overflow or by Gepser
Published on 2013-06-24T22:08:16Z Indexed on 2013/06/24 22:21 UTC
Read the original article Hit count: 109

Filed under:
|
|
|

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>

© Stack Overflow or respective owner

Related posts about variables

Related posts about mvc