lrente
lrente

Reputation: 1130

knockoutjs bind part of string

I have a string in my web page with the current format: "This are the games which USERNAME subscribed". USERNAME takes the logged in username value. I only want to bind the USERNAME attribute, and mantain the rest of the string in the same html element, rather than having a span with the first part, a different one with the binding attribute, and a last one with the last part.

I haven't something like this anywhere. Does anyone knows how to do this, or if this is even possible.

Upvotes: 1

Views: 597

Answers (1)

chris vietor
chris vietor

Reputation: 2060

you could do it that way:

<span data-bind="text: 'This are the games which '  + USERNAME() + ' subscribed'" ></span>

although not very nice when you want to localize your application...

Upvotes: 1

Related Questions