2012-12-21 31 views
1

我想知道为什么下面不工作:transparency.js嵌套平原值

的CoffeeScript:

post = 
    title: 'Hello World', 
    post:  'Hi there it is me', 
    comments: [ 
    name: 'John', 
    text: 'That rules' 
    , 
    name: 'Arnold', 
    text: 'Great post!', 
    tags: ['a', 'b', 'c'] 
    ] 

directives = 
    tags: 
    tag: 
     text: (target) -> this.value 


$('.container').render post, directives 

模板:

<div class="container"> 
    <h1 class="title"></h1> 
    <p class="post"></p> 
    <div class="comments"> 
    <div class="comment"> 
     <span class="name"></span> 
     <span class="text"></span> 
     <div class="tags"> 
     <span class='tag'></span> 
     </div> 
    </div> 
    </div> 
</div> 

它不渲染嵌套平原标签,也没有执行指令功能

任何想法?

+0

''永远不会关闭。 –

+0

@Alex:这是一个错字,我纠正了这个问题。我刚刚检查了http://leonidas.github.com/transparency/并且标签仍然不显示在结果中。 – moritz

回答

0

这是正确的一组指令:

directives = 
    comments: 
    tags: 
     tag: 
     text: (target) -> this.value 

指令不跳过未提及的顶层方式正常值做级联,所以你必须包括comments层。