我在Meteor中有以下辅助函数:
sourceArray : function () {
sources = [];
for (var i = 0; i < images.length; i++) {
if (!isInArray(images[i].source, sources)) {
sources.push(images[i].source);
}
}
return sources;
}
Run Code Online (Sandbox Code Playgroud)
我也有这个辅助功能:
imageTitle : function (source) {
var index = sources.indexOf(source);
return images[index].title;
}
Run Code Online (Sandbox Code Playgroud)
在我的HTML中,我想使用这样的帮助器,{{this}}作为参数传递:
<div class="row">
{{#each sourceArray}}
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<a href="#" class="thumbnail">
<img class="img-responsive" src={{this}}>
</a>
<!-- THIS IS THE IMPORTANT BIT -->
{{imageTitle {{this}} }}
</div>
{{/each}}
</div>
Run Code Online (Sandbox Code Playgroud)
这样做,我收到以下错误:
Errors prevented startup:
While building the application:
art.html:55: Expected identifier, number, string, boolean, or null
... <h3>{{imageTitle {{this}} }}</h3>
...
^
Run Code Online (Sandbox Code Playgroud)
我该怎么做才能解决这个问题?
| 归档时间: |
|
| 查看次数: |
56 次 |
| 最近记录: |