Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : Can I create nested templates with EJS?

$
0
0
Correct, you might have to initialize the template separately. This can be either in a separate file or from a string like this:
  1. can.view('comobobox.ejs', {
  2. itemView: can.view.ejs('<span><%= this.attr('title') %></span>')
  3. });

  4. // combobox.ejs
  5. <ul class="combobox">
  6. <% items.each(function(item) { %>
  7. <li class="item"><%== itemView.render(item) %></li>
  8. <% }) %>
  9. </ul>
I found that with live binding I generally don't really need many nested templates though.

Viewing all articles
Browse latest Browse all 3491

Trending Articles