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

Attach model to dom in a Mustache template {{el -> CODE}}

$
0
0
In EJS I attached my models to a div like this:

  1. <%list(items, function(item) {%>
  2. <div class="item" <%=(el) -> el.data('model', item)%>><%=item.attr('name')%></div>
  3. <%});%>

Is it possible to something like this with Mustache, adding the {{.}} to my dom element?

Example (not working):
  1. {{#items}}
  2. <div class="item" {{(el) -> el.data('model', .)}}>{{name}}</div>
  3. {{/items}}

Viewing all articles
Browse latest Browse all 3491

Trending Articles