Javascript 开始使用Ember.js

Javascript 开始使用Ember.js,javascript,ember.js,Javascript,Ember.js,我没有找到任何关于Ember.js入门的好文档。请帮帮我, 下面是一个简单的例子,我试过了,但屏幕上什么也没显示 Error: MyApp is not defined Javascript:app.js MyApp.president = Ember.Object.create({ firstName: "Barack", lastName: "Obama", fullName: function() { return this.get('firstName

我没有找到任何关于Ember.js入门的好文档。请帮帮我, 下面是一个简单的例子,我试过了,但屏幕上什么也没显示

Error:  MyApp is not defined  
Javascript:app.js

    MyApp.president = Ember.Object.create({
  firstName: "Barack",
  lastName: "Obama",
  fullName: function() {
    return this.get('firstName') + ' ' + this.get('lastName');
  // Tell Ember that this computed property depends on firstName
  // and lastName
  }.property('firstName', 'lastName')
});
HTML


美国总统是{{MyApp.President.fullName}。


我包括了入门工具包中的所有JS文件

您必须定义
MyApp

我创建了一个工作示例。单击运行按钮查看结果

HTML

<p>
<script type="text/x-handlebars">
  The President of the United States is {{MyApp.president.fullName}}.
</script>
</p>​

您忘记定义MyApp,它必须是Ember的实例。应用程序:

var MyApp = Ember.Application.create({});

这是我几周前发现的一个非常全面的教程,可能对您的学习非常有用:

“我没有找到任何好的文档”???你看了吗?是的,但是,文档中的示例不起作用。请看我的密码,对不起。这是我的答案,嗯,似乎在解释,是吧??
window.MyApp = Ember.Application.create();

MyApp.president = Ember.Object.create({
  firstName: "Barack",
  lastName: "Obama",
  fullName: function() {
    return this.get('firstName') + ' ' + this.get('lastName');
  }.property('firstName', 'lastName')
});
​
var MyApp = Ember.Application.create({});