2013-06-09 2 views
0

이 유성 컬렉션이 있습니다. 페이지에 표시 할 질문을 얻을 수 있지만 배열의 각 항목에 라디오 단추를 추가 할 수 있도록 배열 'ansChoices'를 별도로 표시하는 방법을 모릅니다.유성에서 중첩 배열에 액세스하는 방법

//

pollQuestion { "질문"MongoDB를 내 테이블 : "재미인가?", "ansChoices": [ "예", "아니오" ] "_id": "4rfqgkbZWPRjqkgAR "}

//poll.js

Template.pollQn.view = function(){ 
    return pollQuestion.find({}); 
    }; 

//poll.html

<template name="pollQn"> 
    {{#each view}} 
     <div class="text-inverse"><b>{{question}}</b></div> 
     {{#each ansChoices}} 
     <div class="text-inverse">//what should i put here to display 
     individual item in the ansChoices array</div> 
     {{/each}} 
    {{/each}} </template> 

미리 감사드립니다.

답변

1

컨텍스트가 문자열이기 때문에 컨텍스트 자체를 사용해야합니다. {{this}}

+0

감사합니다! 이제 작동합니다. –

관련 문제