How to implement partial view with ejs?

1,655 views
Skip to first unread message

alexaschka

unread,
Jul 16, 2010, 5:34:52 AM7/16/10
to Express
subj

alexaschka

unread,
Jul 16, 2010, 6:01:13 AM7/16/10
to Express
ok, this way works :

in the template use
<%= templ %>

and while render:

this.render('index.html.ejs', {
...
locals: { templ: this.partial('part.html.ejs') }
});

On Jul 16, 12:34 pm, alexaschka <murzz...@gmail.com> wrote:
> subj

tjholowaychuk

unread,
Jul 16, 2010, 10:57:19 AM7/16/10
to Express
Typically you would have something like this (with 1.x):

res.render('index.ejs');

and in your index.ejs:

<%- partial('part') %>

My new ejs project is a not an insanely solid implementation but I
would like
to get it up there with jade in quality. By default <%= will escape
html, <%- does not

http://github.com/visionmedia/ejs
Reply all
Reply to author
Forward
0 new messages