0

我正在尝试开始学习 Ember.js,当页面加载时我收到了这个错误:

Assertion failed: Ember Handlebars requires Handlebars version 1.0.0-rc.4. 
Include a SCRIPT tag in the HTML HEAD linking to the Handlebars file before 
you link to Ember.

但是,我去了Ember.js 的“关于”页面并下载了入门工具包。它附带以下文件:

  • ember-1.0/0-rc.6.js
  • 车把-1.0.0-rc.4.js
  • jquery-1.9.1.js

我在 ASP MVC 3 项目中这样做,所以这里有一些 Razor 语法,但这是我的_Layout.cshtml文件。我目前在主页中没有任何内容Index,因此这实际上是将加载到页面上的所有 HTML。

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/bootstrap.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.9.1.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/ember-1.0.0-rc.6.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/handlebars-1.0.0-rc.4.js")" type="text/javascript"></script>
</head>
<body>
    <div class="page">
        <header>
            <div id="title">
                <h1>Bootstrap/Ember.js Sample Application</h1>
            </div>
        </header>
        <section id="main">
            @RenderBody()
        </section>
        <footer>
        </footer>
    </div>
</body>
</html>
4

1 回答 1

0

刚刚解决了这个问题。不知道您需要在 ember 之前放置把手脚本。声明现在看起来像这样:

<script src="@Url.Content("~/Scripts/jquery-1.9.1.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/handlebars-1.0.0-rc.4.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/ember-1.0.0-rc.6.js")" type="text/javascript"></script>
于 2013-07-16T03:22:25.577 回答