DurandalJS - 未在#applicationHost中加载shell

时间:2014-04-20 23:13:37

标签: jquery shell knockout.js requirejs durandal

在我设置了所有内容并运行我的应用程序之后,在网络上我可以看到shell.html被提取但未加载到id为applicationHost的div标签中,因为它应该如此。此外,没有错误发生,所以我弄清楚出了什么问题。有人可以帮忙吗?

main.js

require.config({
    paths: {
        "text": "text",
        "durandal": "durandal",
        "plugins": "durandal/plugins",
        "transitionions": "durandal/transitions",
        "viewmodels": "viewmodels",
        "views": "views",
        "logger": "services/logger",
        "system": "durandal/system",
        "app": "durandal/app",
        "viewLocator": "durandal/viewLocator"
    }
});


define(['system', 'app', 'viewLocator', 'logger'], function (system, app, viewLocator, logger) {

    system.debug();

    viewLocator.useConvention();

    app.start().then(function () {
        app.setRoot('viewmodels/shell', 'entrance');
    });

});

shell.js

define(['system', 'logger'],
    function (system, logger) {

        var shell = {
            activate: activate
        };

        return shell;

        function activate() {
            logger.log('Application is Loaded!', null, system.getModuleId(shell), true);
        }
});

index.cshtml - body

<body>
    <div id="applicationHost">
        @RenderPage("_splash.cshtml")
    </div>
    @Scripts.Render("~/bundles/vendor")
    <script src="~/Scripts/require.js" data-main="App/main"></script>
</body>

shell.html

<div>
    <header>
        <nav class="navbar navbar-fixed-top">
            <div class="navbar-inner">
                <a class="brand" href="/">
                    <span class="title">Code Camper</span>
                    <span class="jump-start-title">[Jumpstart] 00-Durandal - 1 Page</span>
                </a>
            </div>
            <div class="navbar-inner navbar-secondary"></div>
        </nav>
    </header>
    <section id="content" class="main container-fluid">
        <!-- ko compose: {model: 'speakers', activate: true} -->
        <!-- /ko -->
    </section>
</div>

This is what i mean by Fetched

我的意思是没有加载的是它没有显示在#applicationHost取代启动画面的位置。

This is how my folders and files are set

1 个答案:

答案 0 :(得分:0)

我发现错误最终归结到我放置durandal文件夹的位置,所以我尝试将其移动到Scripts文件夹,它的工作原理并不知道为什么但是显然durandal会在那里工作,如果有人可以解释这种行为以及如何改变它请与我分享你的知识,并感谢为这个问题做出贡献的每一个人,并试图提供帮助:)。