小编Avi*_*i A的帖子

为什么嵌套模板输出中的每一个都没有

虽然这是按预期呈现的:

{{#each Items}}  // a collection
  {{title}}  
{{/each}}  
{{#each types}}  // another ollection
  {{refId}}  
{{/each}}  
Run Code Online (Sandbox Code Playgroud)

如果我把它放在一起:

{{#each Items}}  
  {{title}}  
  {{#each types}}  
    {{refId}}  
  {{/each}} 
{{/each}} 
Run Code Online (Sandbox Code Playgroud)

#each types是空的.

模板助手:

Template.menuItems.helpers({
    restMenuItems: function() {
        return RestMenuItems.find({restRefId: this._id}, {sort:Template.instance().sort.get()});
    },
    restMenuSideItems: function() {
        return RestMenuSideItems.find({restRefId: this._id},            {sort:Template.instance().sort.get()});
    }
});

Template.menuItems.onCreated( function(){
    this.subscribe('restMenuItems');
    this.subscribe('restMenuSideItems');
});
Run Code Online (Sandbox Code Playgroud)

还有一些模板代码:

{{#each restMenuItems}}
  <div>
    <select class="list-group select_side_addons">
      {{#each restMenuSideItems}}
        <option>{{restRefId}}</option>
      {{/each}}
    </select>
  </div>
{{/each}}
Run Code Online (Sandbox Code Playgroud)

即使更换时{{#each restMenuSideItems}}通过{{#each ../restMenuSideItems}},似乎什么都没有.

怎么了?

javascript meteor spacebars meteor-blaze

5
推荐指数
1
解决办法
57
查看次数

标签 统计

javascript ×1

meteor ×1

meteor-blaze ×1

spacebars ×1