This is a migrated thread and some comments may be shown as answers.

Can't return html text?

3 Answers 94 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 10 May 2012, 02:54 PM
I want a function to return some html into a data-bind="text: getText" but it comes across literally...like if I do

return "<span class='incomplete'>InComplete</span>";

then it renders
<span class='incomplete'>InComplete</span>

And if I encode it, it just renders the encoded strings.

Suggestions?

3 Answers, 1 is accepted

Sort by
0
Accepted
Chris
Top achievements
Rank 1
answered on 11 May 2012, 09:18 AM
Have you tried using the "html" binding instead of "text" ?
0
Accepted
Morne
Top achievements
Rank 2
answered on 11 May 2012, 01:38 PM
As Chris suggests, there is a HTML binding that you can use:

<span data-bind="html: name"></span>
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 11 May 2012, 01:41 PM
Duh, stupid steve :)

Thanks guys, totally spaced on being able to do that...was so used to text: to put in text.
Tags
MVVM
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Chris
Top achievements
Rank 1
Morne
Top achievements
Rank 2
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Share this question
or