入门教程:在'显示模型数据'中更改路由器会产生错误
因此,我提前原谅了我,我显然是全新的烬类型(对于JS也是一个全新的东西。增强的入门教程,一行一行地跟着它(除非我错过了某些东西),当我的浏览器决定渲染除背景之外的任何东西时,我会回过头来注意到它会在改变路由器后立即发生:http://emberjs.com/guides/getting-started/displaying-model-data/入门教程:在'显示模型数据'中更改路由器会产生错误
我提交并推送到github这里:https://github.com/justuseapen/ember_tut_mock
^第一次提交渲染在浏览器罚款,第二次提交是坏的,如果你想看到的差异。
这是我的控制台输出:
Uncaught ReferenceError: Todos is not defined todo.js:1 DEBUG: ------------------------------- ember.js:394
DEBUG: Ember.VERSION : 1.0.0 ember.js:394
DEBUG: Handlebars.VERSION : 1.0.0 ember.js:394
DEBUG: jQuery.VERSION : 1.10.2 ember.js:394
DEBUG: ------------------------------- ember.js:394
event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
Assertion failed: No model was found for 'todo' ember.js:394
(anonymous function) ember.js:394
DEPRECATION: Action handlers contained in an `events` object are deprecated in favor of
putting them in an `actions` object (error on <Ember.Route:ember222>)
at Object.triggerEvent
Error while loading route:
TypeError
ember.js:394
Uncaught TypeError: Cannot set property 'store' of undefined
This is the router.js that breaks the code:
Todos.Router.map(function() {
this.resource('todos', { path: '/' });
});
Todos.TodosRoute = Ember.Route.extend({
model: function() {
return this.store.find('todo');
}
});
这与灯具型号:
Todos.Todo = DS.Model.extend({ title: DS.attr('string'),
isCompleted: DS.attr('boolean')
});
Todos.Todo.FIXTURES = [
{
id: 1,
title: 'Learn Ember.js',
isCompleted: true
},
{
id: 2,
title: '...',
isCompleted: false
},
{
id: 3,
title: 'Profit!',
isCompleted: false
}
];
任何想法是极大的赞赏。
回答:
这是在该版本灰烬数据(也许灰烬/灰烬数据)
http://emberjs.jsbin.com/OpOsIGEK/1/edit
的错误以上是 入门教程:在'显示模型数据'中更改路由器会产生错误 的全部内容, 来源链接: utcz.com/qa/258631.html