我正在尝试使用ember.js,所以我尽可能地遵循教程。我目前有这个HTML:
<!doctype html>
<html>
<head>
<script type="text/x-handlebars" data-template-name="application">
Test
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src="ember-1.0.0-rc.1.min.js"></script>
<script src="handlebars.runtime.js"></script>
<script src="app.js"></script>
</head>
</html>
app.js在哪里:
App = Em.Application.create();
在Chrome中我得到了:
Uncaught TypeError: Object prototype may only be an Object or null ember-1.0.0-rc.1.min.js:18
我哪里错了?
谢谢!
答案 0 :(得分:2)
一些建议:
script
代码的顺序(jquery - &gt;把手 - &gt; ember)body
标记,ember需要能够写入script
代码放在</body>
代码导致:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>bitshiftcop.com</title>
</head>
<body>
<script type="text/x-handlebars" data-template-name="application">
Test
</script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="handlebars-1.0.0-rc.3.js"></script>
<script src="ember-1.0.0-rc.1.js"></script>
<script src="app.js"></script>
</body>
</html>