user606521
user606521

Reputation: 15474

underscore template exception

I have this template:

<tr>
    <td></td>
    <td><%= created =%></td>
    <td></td>
    <td></td>
    <td><a href="#" class="btn btn-warning btn-small"><i class="icon-edit icon-white"></i> Edit</a></td>
</tr>

When I try to process it via:

var row = _.template(user_template, {created: "aa"});

It throws this exception:

Uncaught SyntaxError: Unexpected token ) 

When I remove <%= created =%> it works correctly returning <tr><td>...</tr>

What am I doing wrong?

Upvotes: 0

Views: 110

Answers (2)

Ateszki
Ateszki

Reputation: 2253

It is the trailing =%>

Should be just %>

Like this <%= created %>

Upvotes: 2

CD..
CD..

Reputation: 74176

<%= created =%> should be changed to <%= created %>

Upvotes: 3

Related Questions