Rendering inline templates

520 views
Skip to first unread message

liam

unread,
Jul 10, 2011, 7:52:23 PM7/10/11
to Sammy.js
Hi,

I'm looking for the best way to render templates stored inline in the
page (in <script> elements). I have created a question on stack
overflow to document the answer:
http://stackoverflow.com/questions/6643940/rendering-a-local-template-with-sammy-js

Thanks,
Liam.

Aaron Quint

unread,
Jul 10, 2011, 8:02:22 PM7/10/11
to sam...@googlegroups.com
Since .render() and renderEach rely on load(), you can pass the
template in a jQuery element (or DOM element) in the same way you're
doing it in that example:

.render($('#template'), data)

--AQ

> --
> You received this message because you are subscribed to the Google Groups "Sammy.js" group.
> To post to this group, send email to sam...@googlegroups.com.
> To unsubscribe from this group, send email to sammyjs+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sammyjs?hl=en.
>
>

Nidal Al Hariri

unread,
Sep 10, 2013, 7:03:16 AM9/10/13
to sam...@googlegroups.com
Hi, 

I have tried the suggested method and it seems to work fine, however the data passed to the template are are not rendered properly. 

e.g: it displays as <%= item.title %>  

do we miss any specific template configuration ? 
Reply all
Reply to author
Forward
0 new messages