7
Jqueryテンプレートの例を読んで理解しようとしています。Jqueryテンプレートを理解する
/* {{TMPL}}タグで参照されるという名前のテンプレート、 にマークアップ文字列に変換*/
:このプログラム例で<script id="movieTemplate" type="text/x-jquery-tmpl">
{{tmpl "titleTemplate"}}
<tr class="detail"><td>Director: ${Director}</td></tr>
</script>
<table><tbody id="movieList"></tbody></table>
<script>
var movies = [
{ Name: "The Red Violin", Director: "François Girard" ,Producer : "ssss" },
{ Name: "Eyes Wide Shut", Director: "Stanley Kubrick" },
{ Name: "The Inheritance", Director: "Mauro Bolognini" }
];
/* Convert the markup string into a named template,
referenced by the {{tmpl}} tag */
$.template("titleTemplate", "<tr class='title'><td>${Name}</td></tr>");
/* Render the movies data, using the named template as a nested template */
$("#movieTemplate").tmpl(movies).appendTo("#movieList");
</script>
私はについて理解することはできませんよ我々が入力ムービーをテンプレート関数を呼び出すと、私はコードを削除する場合
をmovieslistidすることを追加していることで、テンプレートを呼び出している $(「#movieTemplate」).tmpl(映画を):私たちは呼んで
$.template("titleTemplate", "<tr class='title'><td>${Name}</td></tr>");
これは機能しません。私たちはこれがなぜ必要なのか、何がここで何をしているのか説明してください。/ *マークアップ文字列を名前付きのテンプレートに変換してください。
私はreadlineを読もうとしましたが、
ありがとう –