为什么索引模板会在emberJS应用程序中隐藏应用程序模板元素

时间:2014-07-21 09:52:23

标签: ember.js handlebars.js

我有像indexows一样的index.html

<body>
      <script type="text/x-handlebars" data-template-name="application">
            <h2> Welcome to Ember.js</h2>
                 {{outlet}}
      </script>
      <script type="text/x-handlebars" data-template-name="index">
            <h2> Welcome to index</h2>
      </script> 
</body>

在浏览器中,我只看到“欢迎使用索引”为什么不

欢迎来到Ember.js 欢迎来到索引

我的路线相关代码是

App.Router.map(function() {
 // put your routes here
});

App.IndexRoute = Ember.Route.extend({ });

我的观点相关代码是

App.ApplicationView = Ember.View.extend({
templateName:'index'
});

我使用以下js

     head.load("css/style.css",
            "js/libs/jquery/jquery-1.10.2.js",
            "js/libs/jquery/jquery-ui-1.10.4.js",
            "js/libs/jquery/jquery.sizes.js",
            "js/libs/jlayout/jlayout.border.js",
            "js/libs/jlayout/jquery.jlayout.js",
            "js/libs/jquery/mutate/mutate.events.js",
            "js/libs/jquery/mutate/mutate.js",
            "js/libs/handlebars-1.3.0.js",
            "js/libs/ember/ember-1.6.1.js",
            "js/app.js",
            "js/views/applicationView.js"
    );

我已经看过如果我已经删除了         TEMPLATENAME: '索引' 从         App.ApplicationView 索引模板没有删除应用程序模板元素但抛出错误

   DEBUG: -------------------------------
   DEBUG: Ember      : 1.6.1
   DEBUG: Handlebars : 1.3.0
   DEBUG: jQuery     : 1.10.2
   DEBUG: -------------------------------
   debug:
   generated -> route:application Object { fullName="route:application"}
   generated -> route:index Object { fullName="route:index"}
   generated -> controller:application Object { fullName="controller:application"}
   Rendering application with <App.ApplicationView:ember212> Object {
              fullName="view:application"}
   generated -> controller:index Object { fullName="controller:index"}
   Rendering index with default view <Ember._MetamorphView:ember228> Object {
              fullName="view:index"}
   Transitioned into 'index'
   TypeError: document.getElementById(...) is null
   document.getElementById( this.morph.start ).parentNode === 
   ember-1.6.1.js (line 32241)

0 个答案:

没有答案