3
아마도이 구조는 Meteor에 적합하지 않을 수도 있고, 아니면 내가 잘못 생각한 것일 수도 있습니다. noSQL db에서 이런 나쁜 관계를 만들려고합니까?Meteor에서 콜렉션과의 관계 생성
Dropzone 및 위젯 모음이 있습니다. Dropzone은 많은 위젯을 가질 수 있으며 각 위젯은 하나 이상의 dropzone에 존재할 수 있습니다.
제 문제는 핸들러가 위젯의 필터링 된 목록을 렌더링하지 못하는 것입니다.
내 DROPZONE 모델
dropzone =
_id: "area1-id"
title: "Area 1"
위젯 모델
widget =
_id: "widget1-id"
title: "My Widget"
dropzones: ['area1-id', 'area2-id']
# each widget stores an id of which dropzones it's associated with
관련 템플릿 구조
{{#each dropzones}}
<div class="dropzone span4">
<h1>{{title}}</h1>
<div class="widget-area">
<div class="hotzone">
{{#widgets _id}} # passing in the current dropzone id
{{/widgets}}
</div>
</div>
</div>
{{/each}}
도우미 기능
# returns the correct sets of widgets, but can't figure
# out how to make it render the widget partial
Handlebars.registerHelper 'widgets', (drop_id)->
widgets = CC.Widgets.find(dropzones: drop_id)
_.each widgets, (widget)->
Template.widget(widget) # this ends up being blank with no error
(약칭 함)
굉장 했어! 이유가 무엇이든간에, 나는 템플릿이 평가 될 때이 값을 감싸는 내 머리를 감쌀 수 없었다. 내가 더 복잡해지기 시작했다. –
그래, 익숙해지는 데 익숙해졌지만 정말 멋져. –