2013-05-28 2 views
0

Meteor의 템플릿 엔진에서 얻지 못하는 무언가가 있습니다. 콧수염과 함께 사용됩니다. 단순히 코드를 {{#newscope}} {{/ newscope}로 묶어서 json 데이터 소스의 범위를 변경할 수 있습니다. 실제로이 여기 Meteors 템플릿 - 데이터 범위를 변경하는 방법은 무엇입니까?

여기

Template.aName.data = function() 
    { 
     return {"foo":"bar"}; 
    }; 

그럼 내 템플릿 데이터 소스 핸들과 동일한 방식으로 작동하는 것 같다하지 않는 것은 점은 무엇입니까 (부분) 내 HTML 템플릿

<template name="aName"> 
    {{data.foo}} // This prints "bar" 

    {{#data}} 
    {{foo}} // This does not prints anything but [object Object] (I expected "bar") 
    {{/data}} 

    {{#data.foo}} 
    {{.}} // This prints "bar" but oh so ugly… 
    {{/data.foo}} 
</template> 

입니다 ?

답변

1

는 범위

<template name="aName"> 
    {{#with data}} 
    {{foo}} // prints "bar" as expected 
    {{/with}} 
</template> 
을 변경하려면 with 키워드를 사용하여
관련 문제