The thinkmap template module is responsible for loading and rendering Thinkmap JavaScript templates, which end in the extenstion of .jst
Thinkmap JavaScript templates behave like most template engines. They themselves look like any typical HTML file but JavaScript rendering logic is supported via the <% %> operators while outputting content is supported via <%= %> operators.
<% for (var i = 0; i < users.length; i++) { %>
- <%= users[i].lastname %>
<% } &>
Now assumming the list.jst file is relative to the html file and stored under a directory called templates, then
it can be rendered to the div like so:
thinkmap.template('templates/list.jst')
.renderTo(document.getElementById('myDiv'),{users:usersArray});
The usersArray already exists in our HTML page but as we pass it in as data under 'users', it can be referred to
in the template file under users which can be see in the for loop.