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

binding html inside a template

1 Answer 142 Views
Templates
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 09 Jul 2012, 01:26 PM
Hi,

Consider the jsfiddle: 

http://jsfiddle.net/brCCY/1/ 

For the span tag what I'd like to be able to do is 'set' the html (ala innerHTML) of this element using 'Body' however the example I've given fails silently.

I've trawled through http://www.kendoui.com/documentation/framework/templates/overview.aspx and I probably got the inspiration for the possibility from: 
http://www.kendoui.com/blogs/teamblog/posts/12-03-20/mvvm_declarative_initialization_and_html5_data_attributes.aspx 
In my case (where I am using MVVM on top of the template) - I have had no issues binding other things like attr, events etc.

Any thoughts?

Thanks,

Mark.

1 Answer, 1 is accepted

Sort by
0
Mark
Top achievements
Rank 1
answered on 10 Jul 2012, 03:18 PM
After reading further posts in the thread I resolved this myself.

instead of ${Body} or the bind approach

#= Body #

Leaves the HTML unescaped.

I think the documentation could explain this a little better e.g. where it talks about encoding HTML it could show the unencoded results also?

Thanks,

Mark.
Tags
Templates
Asked by
Mark
Top achievements
Rank 1
Answers by
Mark
Top achievements
Rank 1
Share this question
or