2
0

More than 3 years have passed since last update.

node.js(express)のパーシャルとは何なのか

Posted at

パーシャルとは

レンプレート内から更に読み込んで使われる、テンプレート内の小さな部品を”パーシャル”と呼びます。
node.jsのテンプレートはejsなどがあります。

パーシャルの例

<tr>
    <th><%= key %></th><td><%= val %></td>
</tr>

これはテーブル内の一部の例で
これをテンプレートで読み込んで使います。

パーシャルの使い方

テンプレート内で下のように書いて読み込みます。

<%- incluede('パーシャルのファイル名',{受け渡す値}) %>

実際の例

<%- incluede('data_item',{key:key, val:data[key]) %>
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0