【发布时间】:2018-02-14 04:55:15
【问题描述】:
我在 Pyramid 中使用车把。 我正在声明数组:
var profils = [
"Profil 0",
"Profil 1",
"Profil 2',
];
在车把脚本中:
<script id="referents-list-template" type="text/x-handlebars-template">
{{#each users as |user|}}
<tr>
....
<td>
<select name="Profil-{{user.id}}" id="Profil-{{user.id}}" data-id="{{user.id}}">
{{#each ../../profils as |profil|}}
<option value="{{profil.id}}">{{profil.name}}</option>
{{/each}}
</select>
</td>
</tr>
{{/each}}
但是../../profils 不指向profils 数组。
我浏览了几篇关于这个问题的帖子,并认为../ 可以访问父元素,但在我的情况下它没有。
【问题讨论】:
-
请在问题中添加整个
data对象。
标签: scope handlebars.js pyramid