【发布时间】:2016-12-03 19:59:12
【问题描述】:
我正在 EmberJs 中编写第一个程序为 "Hello World" 打印,但出现错误。有人可以帮我吗?
HTML
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.5/handlebars.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.7.0/ember.min.js"></script>
<script>
App = Ember.Application.create();
App.Router.map(function() {
this.resource('index', { path: '/' }, function() {});
this.resource('hi', { path: '/hi' }, function() {});
});
</script>
<script type="text/x-handlebars" data-template-name='index'>
<p>index!</p>
<p>{{#linkTo hi}}hi{{/linkTo}}</p>
</script>
<script type="text/x-handlebars" data-template-name='hi'>
hello world!
</script>
</head>
<body>
</body>
</html>
错误
【问题讨论】:
-
从 Ember 2 开始,开发 Ember 应用程序的首选方法是使用 ember-cli 工作流,它通过包含构建项目所需的所有内容来防止此类错误。 Tom Dale 在 The Road to Ember 2.0 RFC 中提到了这一点。我认为您应该查看 Ember quick start 以了解您在 Ember 环境中的第一步,它涵盖了 Hello world 应用程序的所有内容。
标签: javascript model-view-controller ember.js