我从Backbone转移到Ember,并开始尝试制作博客应用程序。
我收到了错误 -
Uncaught Error: Assertion Failed: The attempt to link-to route 'posts' failed. The router did not find 'posts' in its possible routes: 'loading', 'error', 'index', 'application'
这是我到目前为止 -
Blog.Router.map = function() {
this.resource('posts');
}
Blog.PostsRoute = Ember.Route.extend({
model: function() {
this.get('store').findAll('post')
}
})
Blog.Post = DS.Model.extend({
name: DS.attr('string')
});
答案 0 :(得分:0)
map
是一个函数,而不是您设置的属性。
Blog.Router.map( function() {
this.resource('posts');
});