4

次のように、定義した「テキスト フィールド」ヘルパー メソッドにテンプレート データを渡したいと思います。

{{textfield label="{{label}}"
            id="account_{{attributes.id}}"
            name="account[{{attributes.name}}]"
            class="some-class"
            required="true"}}

({{textfield}} ヘルパー呼び出し内の {{label}} および {{attributes.id}} 参照に注意してください)

テンプレートを設定した場所は次のとおりです。

data = {
  "attributes": {
    "id": "name",
    "name": "name"
  },
  "label": "Name"
}
var templateHtml = 'markup here';
var template = Handlebars.compile(templateHtml);
var formHtml = template(data);

ここにjsFiddleがあります。

これを実行すると、コンパイルされたマークアップに {{placeholders}} がまだ表示されます。

どうすればこれを達成できますか?

4

2 に答える 2