mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
599 B
24 lines
599 B
13 years ago
|
<html>
|
||
|
<head>
|
||
|
<script src="../ejs.js"></script>
|
||
|
<script id="users" type="text/template">
|
||
|
<% if (names.length) { %>
|
||
|
<ul>
|
||
|
<% names.forEach(function(name){ %>
|
||
|
<li><%= name %></li>
|
||
|
<% }) %>
|
||
|
</ul>
|
||
|
<% } %>
|
||
|
</script>
|
||
|
<script>
|
||
|
onload = function(){
|
||
|
var users = document.getElementById('users').innerHTML;
|
||
|
var names = ['loki', 'tobi', 'jane'];
|
||
|
var html = require('ejs').render(users, { names: names });
|
||
|
document.body.innerHTML = html;
|
||
|
}
|
||
|
</script>
|
||
|
</head>
|
||
|
<body>
|
||
|
</body>
|
||
|
</html>
|