Node.js Jade:times中的每个val返回“;没有这样的功能:val";

Node.js Jade:times中的每个val返回“;没有这样的功能:val";,node.js,coffeescript,pug,Node.js,Coffeescript,Pug,我有以下的翡翠: template(name='hello') button(class="ui grey basic button", id="clickme") i(class="sun icon") | Times div(class="ui list") each val in times div.item= val 其中times是从JS helper方法调用的会话变量 我正在运行Meteor服务

我有以下的翡翠:

template(name='hello')
    button(class="ui grey basic button", id="clickme")
        i(class="sun icon")
        | Times
    div(class="ui list")
        each val in times
            div.item= val
其中times是从JS helper方法调用的会话变量

我正在运行Meteor服务器,使用语义UI作为我的设计框架。 当我尝试使用此Jade时,页面检查器控制台(在Chrome中)返回

我不确定要修复什么,因为我正在严格遵循Jade(和Meteor Jade)文档


谢谢

每个
都不适用于中的
。尝试:

翡翠:

div(class="ui list")
  each times
    div.item= val
if (Meteor.isClient) {
  Session.set('times', [{val: 'value1'}, {val: 'value2'}]);

  Template.hello.helpers({
    times: function () {
      return Session.get('times');
    }
  });
}
div(class="ui list")
  each times
    div.item= this
if (Meteor.isClient) {
  Session.set('times', ['value1', 'value2']);
  ...
}
Js:

div(class="ui list")
  each times
    div.item= val
if (Meteor.isClient) {
  Session.set('times', [{val: 'value1'}, {val: 'value2'}]);

  Template.hello.helpers({
    times: function () {
      return Session.get('times');
    }
  });
}
div(class="ui list")
  each times
    div.item= this
if (Meteor.isClient) {
  Session.set('times', ['value1', 'value2']);
  ...
}

或者,如果会话变量中有数组而不是对象,则可以使用
this

翡翠:

div(class="ui list")
  each times
    div.item= val
if (Meteor.isClient) {
  Session.set('times', [{val: 'value1'}, {val: 'value2'}]);

  Template.hello.helpers({
    times: function () {
      return Session.get('times');
    }
  });
}
div(class="ui list")
  each times
    div.item= this
if (Meteor.isClient) {
  Session.set('times', ['value1', 'value2']);
  ...
}
Js:

div(class="ui list")
  each times
    div.item= val
if (Meteor.isClient) {
  Session.set('times', [{val: 'value1'}, {val: 'value2'}]);

  Template.hello.helpers({
    times: function () {
      return Session.get('times');
    }
  });
}
div(class="ui list")
  each times
    div.item= this
if (Meteor.isClient) {
  Session.set('times', ['value1', 'value2']);
  ...
}

你能提供你的js代码吗?这个错误似乎表明val函数的作用域不是可以读取的。JS代码在了解问题所在/问题所在方面肯定很有用。