1 render传递多值
router.get('/', function(req, res, next) { res.render('index', { homeTitle: 'Hello All', homeDescription:'I gonna to write something' });
<p class="title"><%= homeTitle %></p> <p class="description"><%=homeDescription%></p>
2 循环绑定到界面
router.get('/', function (req, res, next) { res.render('index', { homeTitle: 'Hello All', homeDescription: 'I gonna to write something', homeIconLists: [ { className: 'icon-jquery', description: 'jQuery' }, { className: 'icon-angular', description: 'AngularJs' }, { className: 'icon-nodeJS', description: 'AngularJs' } ] }); });
<ui class="embers"> <% for(var i=0;i< homeIconLists.length;i++){%> <li class="ember-view"> <a> <i class="ember-icon <%=homeIconLists[i].className%>"></i> <!--<strong>jQuery</strong>--> </a> </li> <%}%> </ui>