(3)nodejs baic knowledge

1684 ワード

1レンダーリレー多値
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>