我想知道为什么下面的方法不起作用:
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>它不会呈现嵌套的普通标记,也不会对它们执行指令函数
有什么想法吗?
发布于 2013-05-21 16:11:41
以下是正确的指令集:
directives =
comments:
tags:
tag:
text: (target) -> this.value指令不会像普通值那样跳过未提及的顶层进行级联,因此您必须包含comments层。
https://stackoverflow.com/questions/13994331
复制相似问题