2016-02-11 34 views
-1

我在appname.js文件的數組,看起來像這樣:我想吐出我留着的一個數組的流星列表;不顯示

if (Meteor.isClient) { 

    Template.body.helpers({ 
    tasks: [ 
     { text: "This is task 1" }, 
     { text: "This is task 2" }, 
     { text: "This is task 3" } 
    ] 
    }); 

} 

我有一個文件夾「意見」,在客戶端文件夾,那我保持一個「services.html」文件在那個文件中,我有:

<template name="services"> 
       <ul> 
       {{#each tasks}} 
        {{> task}} 
       {{/each}} 
       </ul> 
</template> 

<template name="task"> 
<li>{{text}}</li> 
<template> 

但是,任務沒有顯示在視圖中。到底是怎麼回事?

回答

0

您使用了錯誤的template.It應該Template.services.helper代替Template.body.helper

+0

HM這不是它在流星教程中的例子:https://www.meteor.com/tutorials/blaze/templates 另外,它給了我一個錯誤,說意想不到的令牌 – user1072337

+0

哦,對不起,脫脂速度太快。請檢查更新 –

相關問題