如何将 MVC3 jQuery 模板转换为 MVC2?
所以我正在尝试遵循 Knockout 教程,不幸的是该教程使用的是 MVC3,而我只有 MVC2 和 VS2008。
我怎样才能运行这样的东西:
<script id="tagsTempl" type="text/html">
<ul>
{{each tags}}
<li class="tagItem">
<span>${Name}</span>
<div>
<a href="#" class="tag-edit">Edit</a> <a href="#" class="tag-delete">Delete</a>
</div>
</li>
{{/each}}
</ul>
</script>
在Webforms ViewEngine中?除非我使用 Razor,否则 {{each}}
和 ${}
不会编译。我尝试将其括在 <% %>
中,但这不起作用。
So I'm trying to follow a tutorial for Knockout, unfortunately the tutorial is using MVC3, and I only have MVC2 with VS2008.
How how can I run something like this:
<script id="tagsTempl" type="text/html">
<ul>
{{each tags}}
<li class="tagItem">
<span>${Name}</span>
<div>
<a href="#" class="tag-edit">Edit</a> <a href="#" class="tag-delete">Delete</a>
</div>
</li>
{{/each}}
</ul>
</script>
in the Webforms ViewEngine? the {{each}}
and ${}
wont compile unless I'm using Razor. I tried enclosing in a <% %>
instead but that didnt work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您想遵循什么教程?您能提供一个链接吗?从我所看到的来看,上面代码中的模板似乎是 jQuery 模板,而不是 MVC 或 Knockout。
淘汰赛模板可能看起来像这样:
What tutorial are you trying to follow? Could you possibly provide a link? From what I'm seeing, it looks as if that template in your code above is a jQuery Template, not MVC or Knockout.
A Knockout template might look something like this: