简体   繁体   English

Ember.js应用程序没有呈现?

[英]Ember.js Application not rendering?

I'm just starting out with Ember.js and I'm attempting to use it to render a fairly simple modal application. 我刚刚开始使用Ember.js,我试图用它来渲染一个相当简单的模态应用程序。

Code is here https://gist.github.com/jhogendorn/5076997 代码在这里https://gist.github.com/jhogendorn/5076997

I'm finding that there are no errors, however it is not rendering the application. 我发现没有错误,但它没有渲染应用程序。 What am I doing incorrectly? 我做错了什么? I'm using EmberJS 1.0.0-rc1 我正在使用EmberJS 1.0.0-rc1

If you are using ember rc1 your code cannot work, because you are trying to use the old router API. 如果您使用的是ember rc1,则代码无法正常工作,因为您正在尝试使用旧的路由器API。 Have a look at the guides of Ember. 看看Ember的指南。 http://emberjs.com/guides/routing/defining-your-routes/ The API looks very different now. http://emberjs.com/guides/routing/defining-your-routes/现在,API看起来非常不同。 I guess it does not work, because you are overwriting the default router with your subclass, that does not use the new API. 我想它不起作用,因为你用你的子类覆盖默认路由器,不使用新的API。 You can also have a look at this tutorial: http://twbrandt.github.com/2013/02/11/Ember-Quick_Start_Guide/ It shows a very basic example and i have seen it getting recommended very often. 您还可以查看本教程: http//twbrandt.github.com/2013/02/11/Ember-Quick_Start_Guide/它显示了一个非常基本的示例,我已经看到它经常被推荐。

The reason it is not rendering is due to the $(document).ready(function() {...}); 它不呈现的原因是$(document).ready(function(){...}); you have. 你有。 Ember needs to fire up before the document loads. Ember需要在文档加载之前启动。 Take your ember app out of the $(document).ready function and it should render. 从$(document).ready函数中取出你的ember应用程序,它应该渲染。

Beyond that, as pointed out earlier, you should use the new router API if you are using rc1. 除此之外,如前所述,如果使用rc1,则应使用新的路由器API

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM