2016-09-08 5 views
0

누군가 내 모의 데이터가이 유성 앱에 표시되지 않는 이유를 설명 할 수 있습니까? 어떤 도움이라도 대단히 감사합니다. 이것이 정말 간단해야하기 때문에 나는 당황 스럽다.간단한 유성 템플릿에 데이터가 표시되지 않음

클라이언트/Main.js

import { Template } from 'meteor/templating'; 
import { ReactiveVar } from 'meteor/reactive-var'; 

import './main.html'; 

var accountData = [ 
    { 
    currency: 'USD', 
    available: '3', 
    balance: '1', 
    hold: '0', 
    }, 
    ... 
]; 

Template.accounts.helpers({ 
    account: accountData 
}); 

클라이언트/Main.html

<template name="accounts"> 
    <h3> Accounts</h3> 
    <div class="table-responsive"> 
    <table class="table"> 
     <tr> 
     <th> Currency </th> 
     <th> Balance </th> 
     <th> Available </th> 
     <th> On Hold </th> 
    </tr> 
    {{#each account in accounts}} 
     <tr> 
     <td> {{account.currency}} </td> 
     <td> {{account.available}}</td> 
     <td> {{account.balance}}</td> 
     <td> {{account.hold}} </td> 
     </tr> 
    {{/each}} 
    </table> 
    </div> 
</template> 

답변

3

템플릿 헬퍼가 아니라 객체 또는 배열, 뭔가를 반환하는 함수이어야한다. 또한 이름이 account 인 도우미를 정의했지만 accounts이라는 도우미를 호출하고 있습니다. 사용해보기 :

Template.accounts.helpers({ 
    accounts:() => accountData 
}); 
관련 문제