0

我正在尝试在 ASP.NET MVC5 应用程序中创建 Ember.js SPA。我正在使用下面的网络链接中提供的示例项目。在其中,我创建了一个新的 index.cshtml 以及 application.js 和 routes.js 文件。但是,车把模板未执行。下面是我的代码。有谁知道为什么这不起作用?

我想要的只是显示带有“关于”文本的菜单,然后单击“关于”链接并查看文本“关于此应用程序......”。目前,我看到的只是文本“Test About”,所以我倾向于相信实现是正确的。

https://msdn.microsoft.com/en-us/magazine/dn463786.aspx

EfaAppTabs.cshtml

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link href="Content/bootstrap.css" rel="stylesheet" />
</head>
<body>    
    <h1>Test About</h1>
    <script type="text/x-handlebars" data-template-name="EfaEmberApp-1.0.0">
        <div class="container">
            <div class="page-header">
                <h1>Movies</h1>
            </div>
            <div class="well">
                <div class="navbar navbar-static-top">
                    <div class="navbar-inner">
                        <ul class="nav nav-tabs">
                            <li>{{#linkTo 'about'}}About{{/linkTo}} </li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="container">
                <div class="row">
                    {{outlet}}
                </div>
            </div>
        </div>
        <div class="container">
            <p>&copy;2018 EFA</p>
        </div>
    </script>


    <script type="text/x-handlebars" data-template-name="about">
        <div class="container"></div>
        <h3>About this app...</h3>
    </script>
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/bundles/jquery-ui")
    @Scripts.Render("~/bundles/ember")
    @Scripts.Render("~/bundles/Efa")
</body>
</html>

EfaEmberApp-1.0.0.js

window.App = Ember.Application.create();

EfaEmberRoutes-1.0.0.js

// Routes
App.Router.map(function () {
    this.route('about');
});
4

0 回答 0