TypeError:应用程序.registerInjection不是一个函数
TypeError: Application.registerInjection is not a function
我是ember.js的新手,试图理解ember,但现有的例子"用ember.js构建一个应用程序"不工作,我正面临一些TypeError
,如TypeError: Application.registerInjection is not a function
,我包括脚本
<script src="js/libs/jquery-1.9.1.js"></script>
<script src="js/libs/handlebars-1.0.0-rc.3.js"></script>
<script src="js/libs/ember-1.0.0-rc.3.js"></script>
<script src="js/libs/ember-data-latest.js"></script>
我不明白如何解决它,有人能帮助我吗?
我的app.js代码是
App = Ember.Application.create();
App.Store = DS.Store.extend({
revision: 12,
adapter: 'DS.FixtureAdapter'
});
App.Router.map(function() {
this.resource('posts');
this.resource('about');
});
App.PostRoute = Ember.Route.extend({
model: function() {
return App.Post.find();
}
});
App.Post = DS.Model.extend({
title: DS.attr('string'),
author: DS.attr('string'),
intro: DS.attr('string')
});
App.Post.FIXTURES = [{
id: 1,
title: "Ember leaning",
author: "Anand",
intro: "Write dramatically less code with Ember's Handlebars integrate templates that update automatically when the underlying data changes."
}, {
id: 2,
title: "A framework for creating ambitious web application",
intro: "Don't waste time making trivial choices. Ember.js incorporates common idioms so you can focus on what makes your app special, not reinventing the wheel."
}];
我的index.html代码是
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ember Starter Kit</title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<script type="text/x-handlebars">
<div class="navbar">
<div class="navbar-inner">
<a class="brand" href="#">Bloggr</a>
<ul class="nav">
<li>{{#linkTo 'posts'}}Posts{{/linkTo}}</li>
<li>{{#linkTo 'about'}}About{{/linkTo}}</li>
</ul>
</div>
</div>
{{outlet}}
</script>
<script type="text/x-handlebars" id="posts">
<div class="container-fluid">
<div class="row-fluid">
<div class="span3">
<table class="table">
<thead>
<tr>
<th>Recent Post</th>
</tr>
</thead>
{{#each model}}
<tr>
<td>
<a href="#">{{title}}<small class="muted"> by {{Author}}</small></a>
</td>
</tr>
{{/each}}
</table>
</div>
<div class="span9">
</div>
</div>
</div>
</script>
<script type="text/x-handlebars" id="about">
<div class='about span12 hero-unit'>
<p>IDEX Solution’s aims to provide solutions for Linux Platform, located in Gandhidham, Gujarat. Here at IDEX, we provide services to small / medium businesses and home users who want to enjoy the power of Linux.
</p>
<p>Whilst as a company, we were formed in Jan 2004, Company’s founder is working on Linux since 1995. We use Linux in everyday of our lives on our Laptops, Desktops and Servers.
</p>
<p>We specialize in providing Tailor Made Software Solutions for our clients in very affordable prices. Since we use all Open Source Software, which help us to keep our prices very low, so our clients can enjoy this benefit. Visit our <a href="http://idexindia.com/products">Products</a> page for more information on our existing products, we also provide other services as well, kindly visit our <a href="http://idexindia.com/services">Services</a> page for more information.
</p>
</div>
</script>
<script src="js/libs/jquery-1.9.1.js"></script>
<script src="js/libs/handlebars-1.0.0-rc.3.js"></script>
<script src="js/libs/ember-1.0.0-rc.3.js"></script>
<script src="js/libs/ember-data-latest.js"></script>
<script src="js/app.js"></script>
</body>
</html>
首先,您应该从控制台的错误消息中注意到问题在"ember-data-latest.js"中。您不需要发布所有的应用程序代码。其次,在GitHub上找到的ember-data-latest.js不是最新的ember。你可以在这里找到一个可用的ember-data版本:
http://builds.emberjs.com.s3.amazonaws.com/ember-data-latest.js相关文章:
- 我可以在json对象中添加一个函数吗
- 如何在JQuery函数中定义一个值,然后调用另一个函数并使用该值
- 是否可以将一个函数输入连接到另一个函数调用的文本
- 在另一个函数中使用变量this
- 在另一个函数成功结束后调用该函数
- mongoose.connect undefined不是一个函数
- 监听器必须是一个函数
- 使用JS函数来使用另一个函数的语法?node.js
- 如何取消object.prototypes javascript的一个函数
- 从Chrome扩展名中的popup.html文件在background.js文件中运行一个函数
- 嵌套到另一个函数中的Fancybox函数;不起作用
- 如何在javascript中使用不止一个函数
- jQuery-在页面加载时执行一个函数
- jquery UI draggable:UI.children不是一个函数
- jQuery Mobile Undefined不是一个函数
- 如何在php中创建一个函数,该函数与文本区域一起工作,通过输入类似[color:red]的内容来打印具有等效颜色的文本
- javascript函数将数据添加到屏幕,但随后被另一个函数覆盖
- JS异常:animate不是一个函数
- 如何将一个函数附加到一个不存在的元素上
- JavaScript/jQuery-添加添加和删除类与下一个函数之间的延迟